[Login] Fix, Outseiten wieder öffnen

* man kann wieder auf seiten zugreifen, die garkeine berechtigungen benötigen.
This commit is contained in:
Tim Gröger 2020-11-12 12:47:47 +01:00
parent 70575c94c3
commit 1ce02a67a9
3 changed files with 48 additions and 40 deletions

View File

@ -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 } });

View File

@ -26,7 +26,7 @@
</div>
<q-separator />
<q-separator/>
<div class="col-12 text-h6 q-pa-sm" v-if="$route.name == 'about'">
Geladene Plugins:
</div>
@ -44,7 +44,7 @@
</q-chip>
</q-chip>
</div>
<q-separator />
<q-separator/>
<div class="col-12 text-h6 q-pa-sm">
Entwickler:
</div>
@ -69,7 +69,7 @@
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api';
import {defineComponent} from '@vue/composition-api';
import Developer from 'components/about/Developer.vue';
const developers = [
@ -105,9 +105,9 @@ const developers = [
];
export default defineComponent({
// name: 'PageName'
components: { Developer },
components: {Developer},
setup() {
return { developers };
return {developers};
}
});
</script>

View File

@ -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')
}
]