javascript - Firestore 设置功能不做任何事情(React Native)
问题描述
使用 FB Login 后,我试图从 facebook 个人资料中获取一些信息,并将其存储在我在 firestore 上的用户集合中。在 facebook 成功回调中使用此代码段:
var userDict = {
id: user.uid,
fullname: user.displayName,
email: user.email,
profileURL: user.photoURL + "?type=large"
};
var data = {
...userDict,
appIdentifier: "foodwaste"
};
ref
.doc(user.uid)
.get()
.then(docSnapshot => {
if (!docSnapshot.exists) {
this.ref.doc(user.uid).set(data);
}
});
我的参考是const ref = firebase.firestore().collection("users");
我确定 get 函数在我取回快照时有效,然后它进入 if 语句,之后什么都没有发生,没有错误,并且数据库没有得到更新。这以前可以正常工作,我一直在试图找出为什么它突然不能正常工作了很长时间!将不胜感激任何帮助谢谢。
解决方案
推荐阅读
- session - 带有 CDI 的 JSF 2.3 中的会话固定和会话范围 Bean
- python - 自定义损失函数中没有梯度
- javascript - 自动谷歌登录 WebView React Native
- python - 在 Python 中的 DocuSign 中获取令牌
- ios - 旧 Apple 硬件上的 Cordova 和 Xcode 兼容性
- hybris - 如果数据模型不需要更新,如何减少 Hybris 构建时间?
- sql-server - SQL Server 克隆存储过程,包括授权
- mongodb - 使用优先查询条件查询 Mongoose
- python - Python Flask MySQL 提交将插入,不会更新
- git - 为什么 Bitbucket diff 显示提交列表之外的差异?