Я использовал router.beforeEach
, но вызов функции next()
не работает. Следующая переменная возвращает ошибку. Это функция:
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
// this route requires auth, check if logged in
// if not, redirect to login page.
if (!auth.loggedIn()) {
next({
path: '/login',
query: { redirect: to.fullPath }
})
} else {
next()
}
} else {
console.log(next);
next() // make sure to always call next()!
}
})
Это ошибка, которая отображается в журнале как значение следующей переменной ...
ƒ (to) {
if (to === false || isError(to)) {
// next(false) -> abort navigation, ensure current URL
this$1.ensureURL(true);
abort(to);
.....