November 2017
Beginner to intermediate
398 pages
8h 42m
English
There is another case we don't manage yet--we don't want an already connected user to access the login route!
{ path: '/login', name: 'login', component: Login, meta: { guest: true } },
router.beforeEach((to, from, next) => { // ... if (to.meta.guest && state.user) { next({ name: 'home' }) return } next() })
If you are logged in, you can try going to the login URL--you should be immediately redirected to the home page! You can only access this page if you are not logged in.
Read now
Unlock full access