I am adding auth on vue routes but it is not redirecting back to login page.
Giving this error
Error: Navigation cancelled from "/" to "/pages/login" with a new navigation.
Here is how I appliedt it on routes
router.beforeEach((to, from, next) => {
// If auth required, check login. If login fails redirect to login page
if (!(auth.isAuthenticated())) {
router.push({ path: '/pages/login', name: 'page-login', component: '@/views/pages/login/Login.vue' })
}
return next()
})
I think it is inside the loop and and redirecting too many times