【发布时间】:2019-11-11 05:52:34
【问题描述】:
我只是想找到这个布尔值,如果它是真的,那么它会执行一个代码。否则,它将执行另一个代码。我似乎无法在 Firebase 中读取此布尔值。
This is the data I am trying to read.
上面写着here 我可以做.get(fieldPath) 但我可能做错了。 Firebase 文档真的很糟糕。哈哈
checkIfLoggedIn = () => {
firebase.auth().onAuthStateChanged(user => {
if (user) {
const uid = firebase.auth().currentUser.uid;
const db = firebase.firestore();
db.collection('users')
.doc(uid)
.get('uid.isStore')
.then(snapshot => {
// Trying to find how to do this
console.log(snapshot);
});
this.props.navigation.navigate('mainNav');
} else {
this.props.navigation.navigate('signup');
}
});
};
【问题讨论】:
标签: javascript firebase react-native google-cloud-firestore