Trying to use navigation guard, but next('/auth/login')
gives infinite loop:
router.beforeEach((to, from, next) => {
auth.validate().then((valid) => {
if (!valid) {
next('/auth/login')
} else {
next()
}
})
})
router is define:
const router = new Router({
routes: [
{
name: 'login',
path: '/auth/login',
component: login
}
})