所以我在跟踪
Savvy Apps
学习Vue.js的教程。本教程使用Firebase和Firestore。由于Firestore是Beta版(正如教程中所说),所以可能会发生更改——我认为这里可能就是这样。
无论如何,我想注册一个新用户。我填写表单并单击“注册”,收到以下错误消息:
错误:函数CollectionReference.doc()要求其第一个参数为string类型,但它是:未定义的
但是在Firebase中,我看到用户已经被创建。为什么我会收到这个错误信息?第一个论点是什么?
注册代码如下所示:
signup() {
this.performingRequest = true;
fb.auth.createUserWithEmailAndPassword(this.signupForm.email, this.signupForm.password).then(user => {
this.$store.commit('setCurrentUser', user);
// create user obj
fb.usersCollection.doc(user.uid).set({
name: this.signupForm.name,
title: this.signupForm.title
}).then(() => {
this.$store.dispatch('fetchUserProfile');
this.performingRequest = false;
this.$router.push('/dashboard')
}).catch(err => {
console.log(err);
this.performingRequest = false;
this.errorMsg = err.message
})
}).catch(err => {
console.log(err);
this.performingRequest = false;
this.errorMsg = err.message
})
},
如果需要更多代码,请告诉我—这是我第一次测试Vue.js。