I am using VUEX and Firebase to create a register form with three fields NAME, EMAIL, PASSWORD.
(我正在使用VUEX和Firebase创建具有三个字段NAME,EMAIL,PASSWORD的注册表。)
First i am using createUserWithEmailAndPassword method to add the user but I also want to ad the name filed data to an Existing Blank collection, here I am using set method. (首先,我正在使用createUserWithEmailAndPassword方法添加用户,但我也想将名称字段数据添加到“现有空白”集合中,这里我使用set方法。)
But it is not adding the name field data in the collection. (但这不是在集合中添加名称字段数据。)
methods: {
onSignUp() {
firebase
.auth()
.createUserWithEmailAndPassword(this.email, this.password)
.then(user => {
console.log(user);
console.log(user.user.uid);
firebase.database.collection("profiles").doc(user.user.id).set({
name: this.name
})
.then(function() {
console.log("Document successfully written!");
})
.catch(function(error) {
console.error("Error writing document: ", error);
});
this.$store.dispatch('signUserUp', user);
})
.catch(error => {
this.$store.dispatch('signUserError', error)
});
}
}
data(){
return {
name: "",
email: "",
password: "",
}
}
After submitting the form it's adding a new user and I can also see the uid in the console but some how its not updating the name field in the database.
(提交表单后,它添加了一个新用户,我还可以在控制台中看到uid,但是有些不更新数据库中的name字段。)
ask by RAHUL KUNDU translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…