@@ -33,8 +33,8 @@ const router = createRouter({
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/support',
|
||||
name: 'support',
|
||||
path: '/administration',
|
||||
name: 'administration',
|
||||
// this page is lazy-loaded when the route is visited.
|
||||
component: () => import('../views/AdministrationView.vue'),
|
||||
meta: {
|
||||
@@ -87,12 +87,17 @@ const router = createRouter({
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
//if user was logged in but reloaded page. So we have all data, need only restore it
|
||||
if (store.state.keycloak.keycloak !== null && getKeycloak() === null) {
|
||||
await keycloakSetup()
|
||||
}
|
||||
|
||||
if (to.meta.requiresAuth === true) {
|
||||
if (getKeycloak() === null) {
|
||||
await keycloakSetup()
|
||||
store.commit('initKeycloak', getKeycloak())
|
||||
store.commit('isAnonym', false)
|
||||
}
|
||||
if (!getKeycloak().authenticated) {
|
||||
next('/forbidden')
|
||||
|
||||
Reference in New Issue
Block a user