diff --git a/src/router/routes.ts b/src/router/routes.ts index 1a7fb8a9..8d8934e2 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -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'), }, {