i'm doing login, but after the login methods gets success, i'm pushing a route for the $router
object and it's not working, can someone help me?
my code:
doLogin(){
this.attemptLogin({...this.user}).then(function(){
this.$router.push('/')
} )
},
So, the login methods execute as expected, but the callback this.$router.push('/')
does not runs
my attemptLogin
is an action, it's code is following:
export const attemptLogin = ( {commit}, user) => {
return http.post('login', {
'email': user.email,
'password': user.password
}).then(response => {
return commit(types.setToken, response.data)
}).catch( e => console.log(e))
}
Solved, i changed the method this.$router.push()
from my code, to this.$router.go('/')
.
Thanks for everyone in comments.