feat: routes guard
This commit is contained in:
parent
ac1dddf5c3
commit
9558d95fcf
1 changed files with 31 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { RouteRecordRaw } from 'vue-router';
|
||||
import { isRoleInclude } from 'stores/utils';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
|
|
@ -14,11 +15,41 @@ const routes: RouteRecordRaw[] = [
|
|||
{
|
||||
path: '/branch-management',
|
||||
name: 'BranchManagement',
|
||||
beforeEnter: (to, from, next) => {
|
||||
if (
|
||||
isRoleInclude([
|
||||
'admin',
|
||||
'branch_admin',
|
||||
'head_of_admin',
|
||||
'system',
|
||||
'owner',
|
||||
])
|
||||
) {
|
||||
next();
|
||||
} else {
|
||||
next('/');
|
||||
}
|
||||
},
|
||||
component: () => import('pages/01_branch-management/MainPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/personnel-management',
|
||||
name: 'PersonnelManagement',
|
||||
beforeEnter: (to, from, next) => {
|
||||
if (
|
||||
isRoleInclude([
|
||||
'admin',
|
||||
'branch_admin',
|
||||
'head_of_admin',
|
||||
'system',
|
||||
'owner',
|
||||
])
|
||||
) {
|
||||
next();
|
||||
} else {
|
||||
next('/');
|
||||
}
|
||||
},
|
||||
component: () => import('pages/02_personnel-management/MainPage.vue'),
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue