-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
509c6a2
commit 6e11e9e
Showing
10 changed files
with
367 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
import { useRouter } from 'vue-router'; | ||
|
||
import { accessHandler, createProps } from '@/router'; | ||
import useAuthZStore, { NavigationPermission } from '@/store/authzStore'; | ||
import { RouteName } from '@/utils/enums/application'; | ||
|
||
import type { RouteRecordRaw } from 'vue-router'; | ||
|
||
const routes: Array<RouteRecordRaw> = [ | ||
{ | ||
path: '/housing', | ||
meta: { requiresAuth: true, breadcrumb: 'Housing' }, | ||
children: [ | ||
{ | ||
path: '', | ||
name: RouteName.HOUSING, | ||
component: () => import('../views/housing/HousingView.vue'), | ||
beforeEnter: () => { | ||
const authzStore = useAuthZStore(); | ||
if (!authzStore.canNavigate(NavigationPermission.HOUSING)) { | ||
useRouter().replace({ name: RouteName.HOUSING_SUBMISSIONS }); | ||
} | ||
}, | ||
meta: { | ||
access: [NavigationPermission.HOUSING], | ||
breadcrumb: 'Housing' | ||
} | ||
}, | ||
{ | ||
path: 'enquiry', | ||
children: [ | ||
{ | ||
path: '', | ||
name: RouteName.HOUSING_ENQUIRY_INTAKE, | ||
component: () => import('@/views/housing/enquiry/EnquiryIntakeView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE], | ||
breadcrumb: 'Enquiry Form' | ||
} | ||
// name: RouteName.HOUSING_ENQUIRY, | ||
// component: () => import('../views/housing/enquiry/EnquiryView.vue'), | ||
// beforeEnter: accessHandler, | ||
// props: createProps, | ||
// meta: { | ||
// access: [NavigationPermission.HOUSING_ENQUIRY], | ||
// breadcrumb: 'Enquiry Form' | ||
// } | ||
}, | ||
{ | ||
path: 'confirmation/:activityId', | ||
name: RouteName.HOUSING_ENQUIRY_CONFIRMATION, | ||
component: () => import('@/views/housing/enquiry/EnquiryConfirmationView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE], | ||
meta: { hideBreadcrumb: true } | ||
} | ||
} | ||
// { | ||
// path: 'intake', | ||
// name: RouteName.HOUSING_ENQUIRY_INTAKE, | ||
// component: () => import('@/views/housing/enquiry/EnquiryIntakeView.vue'), | ||
// beforeEnter: accessHandler, | ||
// props: createProps, | ||
// meta: { | ||
// access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE], | ||
// breadcrumb: 'Enquiry Form' | ||
// } | ||
// } | ||
] | ||
}, | ||
{ | ||
path: 'intake', | ||
component: () => import('@/views/GenericView.vue'), | ||
children: [ | ||
{ | ||
path: '', | ||
alias: ':draftId', // Trying alias instead of duplicating whole thing with a different path | ||
name: RouteName.HOUSING_SUBMISSION_INTAKE, | ||
component: () => import('@/views/housing/submission/SubmissionIntakeView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_SUBMISSION_INTAKE] | ||
} | ||
}, | ||
{ | ||
path: 'confirmation/:activityId', | ||
name: RouteName.HOUSING_SUBMISSION_CONFIRMATION, | ||
component: () => import('@/views/housing/submission/SubmissionConfirmationView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_SUBMISSION_INTAKE] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
path: 'project', | ||
meta: { | ||
access: [NavigationPermission.HOUSING_STATUS_TRACKER] | ||
}, | ||
children: [ | ||
{ | ||
path: ':submissionId', | ||
component: () => import('@/views/GenericView.vue'), | ||
children: [ | ||
{ | ||
path: '', | ||
component: () => import('@/views/housing/project/ProjectView.vue'), | ||
beforeEnter: accessHandler, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_STATUS_TRACKER], | ||
breadcrumb: 'Project', | ||
breadcrumb_dynamic: true | ||
}, | ||
name: RouteName.HOUSING_PROJECT, | ||
props: createProps | ||
}, | ||
{ | ||
path: 'enquiry', | ||
component: () => import('@/views/GenericView.vue'), | ||
children: [ | ||
{ | ||
path: '', | ||
alias: ':enquiryId', // Trying alias instead of duplicating whole thing with a different path | ||
name: RouteName.HOUSING_ENQUIRY_INTAKE, | ||
component: () => import('@/views/housing/enquiry/EnquiryIntakeView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE], | ||
breadcrumb: 'Enquiry Form' | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
path: 'intake', | ||
name: RouteName.HOUSING_SUBMISSION_INTAKE, | ||
component: () => import('@/views/housing/submission/SubmissionIntakeView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_SUBMISSION_INTAKE], | ||
breadcrumb: 'Project Intake Form' | ||
} | ||
}, | ||
{ | ||
path: 'permit/:permitId', | ||
component: () => import('@/views/GenericView.vue'), | ||
children: [ | ||
{ | ||
path: '', | ||
component: () => import('@/views/permit/PermitStatusView.vue'), | ||
beforeEnter: accessHandler, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_STATUS_TRACKER], | ||
breadcrumb: 'Permit', | ||
breadcrumb_dynamic: true | ||
}, | ||
name: RouteName.HOUSING_PROJECT_PERMIT, | ||
props: createProps | ||
}, | ||
{ | ||
path: 'enquiry', | ||
name: RouteName.HOUSING_ENQUIRY_INTAKE, | ||
component: () => import('@/views/housing/enquiry/EnquiryIntakeView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
path: 'submission', | ||
children: [ | ||
{ | ||
path: '', | ||
name: RouteName.HOUSING_SUBMISSION, | ||
component: () => import('@/views/housing/submission/SubmissionView.vue'), | ||
beforeEnter: accessHandler, | ||
props: createProps, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_SUBMISSION] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
path: 'submissions', | ||
name: RouteName.HOUSING_SUBMISSIONS, | ||
component: () => import('@/views/housing/SubmissionsView.vue'), | ||
beforeEnter: accessHandler, | ||
meta: { | ||
access: [NavigationPermission.HOUSING_SUBMISSIONS] | ||
} | ||
}, | ||
{ | ||
path: '/guide', | ||
name: RouteName.HOUSING_GUIDE, | ||
component: () => import('@/views/ComingSoon.vue'), | ||
meta: { access: [NavigationPermission.HOUSING] } | ||
}, | ||
{ | ||
path: '/user', | ||
name: RouteName.USER_MANAGEMENT, | ||
component: () => import('@/views/user/UserManagementView.vue'), | ||
beforeEnter: accessHandler, | ||
meta: { requiresAuth: true, access: [NavigationPermission.HOUSING_USER_MANAGEMENT] } | ||
} | ||
] | ||
} | ||
]; | ||
|
||
export default routes; |
Oops, something went wrong.