I'm trying to make a login system with vue and firebase, but I'm having trouble redirecting the user after authentication:
login: function () {
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(
(user) => {
this.$router.push({name: 'dashboard'})
},
(err) => {
alert('Error: ' + err.message)
}
)
}
With the code this way when calling the login method I get the following error in the console:
uncaught error during route navigation:
followed by an empty red error on the console
I tried to use a self instead of this, because the first problem that came to mind was this, the result was:
login: function () {
let self = this
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(
(user) => {
self.$router.push({name: 'dashboard'})
},
(err) => {
alert('Error: ' + err.message)
}
)
}
but the error remains the same.
Has anyone ever been through this?