mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 20:36:27 +00:00
🎉 First commit, from couchbase generator, basic changes
not tested / updated yet
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import { store } from '@/store';
|
||||
import { readHasAdminAccess } from '@/store/main/accessors';
|
||||
import { dispatchGetRoles } from '@/store/admin/accessors';
|
||||
|
||||
const routeGuardAdmin = async (to, from, next) => {
|
||||
if (!readHasAdminAccess(store)) {
|
||||
next('/main');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
};
|
||||
|
||||
@Component
|
||||
export default class Start extends Vue {
|
||||
public beforeRouteEnter(to, from, next) {
|
||||
routeGuardAdmin(to, from, next);
|
||||
}
|
||||
|
||||
public beforeRouteUpdate(to, from, next) {
|
||||
routeGuardAdmin(to, from, next);
|
||||
}
|
||||
|
||||
public async mounted() {
|
||||
await dispatchGetRoles(this.$store);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user