I recently started exploring Vuejs state management. I attempted to create a login system with Firebase using Vuex. However, I encountered the following error:
signInWithEmailAndPassword failed: First argument "email" must be a valid string
I'm having trouble pinpointing the issue.
<pre>
// store/auth.js
export const actions = {
loginUser(payload){
firebase.auth().signInWithEmailAndPassword(payload.email, payload.password)
.then(user => {
console.log(user);
})
.catch(error => {
console.log(error);
})
}
}
// Login.vue
export default {
data(){
return{
email:'',
password:''
}
},
methods:{
login(){
this.$store.dispatch('auth/loginUser', {email:this.email, password:this.password})
}
}
}
</pre>
// Form
<v-flex xs12>
<v-text-field
v-model="email"
name="email"
label="Email"
type="email"
required></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12>
<v-text-field
v-model="password"
name="password"
label="Password"
type="password"
required></v-text-field>
</v-flex>
</v-layout>