我正在使用 auth 创建一个新用户,该用户正在工作,然后使用新创建的 uid 创建一个具有相同内容的新文档。
const currentUser = await auth.createUserWithEmailAndPassword(email, pass);
console.log('user registered')
await setDoc(doc(db, "users", currentUser.user.uid),{
forname: "Peter",
surname: "Parker"
})
console.log('user profile added')
dispatch({type:'USER_REG', payload: currentUser});
Run Code Online (Sandbox Code Playgroud)
当我收到控制台日志时,reg 进程会毫无问题地启动,然后程序只是等待,就像 setDoc 正在运行但从未完成,我不知道为什么。任何帮助表示赞赏。
javascript firebase reactjs firebase-authentication google-cloud-firestore