[Vuejs]-Vuejs redirect in controller

0👍

So after more deep search I made up a solution without routing from controller. I made a direct route from component using promise to get response from controller.

// Login.vue
return auth.doLogin(this).then(success => {
                this.$router.push(success)
            });

// auth.js
doLogin(context, credentials, redirect) {
    return new Promise((resolve, reject) => {
        axios.post('/post/doAuth', context.login, this.postHeadersJson).then(response => {
    ...

    resolve(...);
}).catch(e => {
    reject(...)
});
    });
}

Leave a comment