gradido/admin/src/router/guards.js
2021-10-26 17:23:52 +02:00

13 lines
284 B
JavaScript

const addNavigationGuards = (router, store) => {
router.beforeEach((to, from, next) => {
// handle authentication
if (to.meta.requiresAuth && !store.state.token) {
next({ path: '/not-found' })
} else {
next()
}
})
}
export default addNavigationGuards