我试图在Google解困后在Firebase中创建一个集合,我用数据构建一个const并可以正常工作,但是firestore无法创建该集合
当我执行console.log数据时,json文件完美显示。我可以访问所有信息。另外,我在Firebase控制台中授予了写权限
submitGoogle() {
const provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then((result) => {
const data = {
uid: result.user.uid,
email: result.additionalUserInfo.profile.email,
name: result.additionalUserInfo.profile.name,
role: 'customer'
};
console.log(data)
db.collection('users').doc(result.user.uid).set(data).then(() =>
{
this.$store.commit('setRole', data.role);
this.$router.push('/');
});
})
.catch((error) => {
this.message = error.message.substr(0, 60);
this.snackBar = true;
setTimeout(() => {
this.snackBar = false;
}, this.timeout);
});
},