For every route, you want to make accessible only for authenticated users add following object:
meta: { auth: true }
Example:
{
path: '/admin/dashboard',
name: 'dashboard',
component: Dashboard,
meta: { auth: true } // You need to be logged in to access this route
}
For every route, you want to make accessible only for unauthenticated users add following object:
meta: { auth: false }
Example:
{
path: '/login',
name: 'login',
component: Login,
meta: { auth: false } // You need to be logged out to access this route
}
Public routes can be accessed by both authenticated and unauthenticated users. For every route, you want to make public do not add meta { auth: ... }
object at all.
Example:
{
path: '/about',
name: 'about',
component: About
}
You can change auth
meta key and true
, false
and null
values for authenticated, unauthenticated and public routes in options object.