[Login] Fix, Outseiten wieder öffnen
* man kann wieder auf seiten zugreifen, die garkeine berechtigungen benötigen.
This commit is contained in:
parent
70575c94c3
commit
1ce02a67a9
|
@ -8,13 +8,6 @@ export default boot<Store<StateInterface>>(({ router, store }) => {
|
|||
const session = store.state.session.currentSession;
|
||||
|
||||
if (to.name != 'login') {
|
||||
if (!session || session.expires <= new Date()) {
|
||||
store.dispatch('session/logout').catch(error => {
|
||||
console.warn(error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
to.matched.every((record: RouteRecord) => {
|
||||
if (!('meta' in record) || !('permissions' in record.meta))
|
||||
|
@ -30,6 +23,20 @@ export default boot<Store<StateInterface>>(({ router, store }) => {
|
|||
}
|
||||
})
|
||||
) {
|
||||
if (
|
||||
!to.matched.every((record: RouteRecord) => {
|
||||
if (!('meta' in record) || !('permissions' in record.meta))
|
||||
return true;
|
||||
else return false;
|
||||
})
|
||||
) {
|
||||
if (!session || session.expires <= new Date()) {
|
||||
store.dispatch('session/logout').catch(error => {
|
||||
console.warn(error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
next();
|
||||
} else {
|
||||
next({ name: 'login', query: { redirect: to.fullPath } });
|
||||
|
|
|
@ -22,17 +22,18 @@ const routes: RouteConfig[] = [
|
|||
path: '/main',
|
||||
redirect: 'dashboard',
|
||||
component: () => import('layouts/MainLayout.vue'),
|
||||
meta: { permissions: ['user']},
|
||||
children: [
|
||||
{
|
||||
name: 'dashboard',
|
||||
path: 'dashboard',
|
||||
meta: { permission: 'user' },
|
||||
meta: { permissions: ['user'] },
|
||||
component: () => import('pages/Dashboard.vue')
|
||||
},
|
||||
{
|
||||
name: 'about',
|
||||
path: 'about',
|
||||
meta: { permission: 'user' },
|
||||
meta: { permissions: ['user'] },
|
||||
component: () => import('pages/about/About.vue')
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue