【发布时间】:2021-07-03 04:04:16
【问题描述】:
我正在尝试创建一个函数,当用户注册时,该函数会在 Firestore 中创建一个具有相应用户 ID 的用户文档。
function signup(email, password) {
return auth.createUserWithEmailAndPassword(email, password)
.then(cred => {
return firebase.firestore().collection('users').doc(cred.user.uid)
.set({email})
})
}
它会在身份验证中创建一个新用户,但它不会在用户集合中创建文档。我使用了在 stackoverflow 和各种教程中找到的此代码的许多变体。不知道还能做什么。
【问题讨论】:
标签: javascript reactjs firebase google-cloud-firestore