Reputation: 1
I am creating an app, however, I want that when I click Signup, register() executes and upon return of a promise I want to route to the login route.
Instead of staying on the same signup page, I want to route to the login page
register(){
axios.post('url', {
username: this.username,
password:this.password
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Upvotes: 0
Views: 2057
Reputation: 2809
Use push()
on the router.
.then(function (response) {
console.log(response);
this.$router.push('login');
})
Vue-router has programmatic navigation.
Upvotes: 2