Vue.js
- 2 ответа
- 0 вопросов
2
Вклад в тег
const authGuard = (to, from, next) => {
if (store.getters.isAuthenticated) {
next();
return;
}
next('/login');
}
const router = new Router({
routes: [
{
path: '/',
name: 'Home',
component: Home,
},
{
path: '/account',
name: 'Account',
component: Account,
beforeEnter: authGuard,
},
});