【发布时间】:2019-01-06 01:46:27
【问题描述】:
所以我正在关注Savvy Apps 教程来学习 Vue.js。本教程使用 Firebase 和 Firestore。由于 Firestore 处于 Beta 版(如教程所述),因此可能会发生变化 - 我认为这里可能就是这种情况。
无论如何,我正在尝试注册一个新用户。我填写表格并单击“注册”,然后收到以下错误消息:
错误:函数 CollectionReference.doc() 要求其第一个参数为字符串类型,但它是:未定义
但是在 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。
【问题讨论】:
标签: javascript firebase vue.js firebase-authentication google-cloud-firestore