I want disable go to url "login" if user is logged in. I no use vuex. And I send ajax from method "beforeRouteEnter"(check login and maiby get data on page), but before, I go to route(I can see html component login page and url "/login") and after redirect from this page.
How to do what I did not go to the specified URL at all?
beforeRouteEnter: (to, from, next) => {
next(function (vm) {
vm.$http.get('http://cake.vue.loc/api/checkLogin')
.then(response => {
return response.json()
})
.then(response_data => {
if (response_data.status == 'success') {
vm.$router.push("/");
}
});
});
}