forked from bcgov/supreme-court-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
85 lines (80 loc) · 2 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { SessionManager } from '@/utils/utils';
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
async function authGuard(to: any, from: any, next: any) {
const results = await SessionManager.getSettings();
if (results) {
next();
}
}
const routes: RouteRecordRaw[] = [
{
path: '/',
redirect: '/dashboard',
name: 'HomeView',
},
{
path: '/court-list',
name: 'CourtList',
component: () => import('@/components/courtlist/CourtList.vue'),
props: true,
children: [
{
path: 'location/:location/room/:room/date/:date',
name: 'CourtListResult',
component: () => import('@/components/courtlist/CourtList.vue'),
props: true,
},
],
},
{
path: '/civil-file/:fileNumber/:section?',
name: 'CivilCaseDetails',
component: () => import('@/components/civil/CivilCaseDetails.vue'),
props: true,
},
{
path: '/criminal-file/:fileNumber',
name: 'CriminalCaseDetails',
component: () => import('@/components/criminal/CriminalCaseDetails.vue'),
props: true,
},
{
path: '/civil-file-search',
name: 'CivilFileSearchResultsView',
component: () =>
import('@/components/civil/CivilFileSearchResultsView.vue'),
props: true,
},
{
path: '/criminal-file-search',
name: 'CriminalFileSearchResultsView',
component: import(
'@/components/criminal/CriminalFileSearchResultsView.vue'
),
props: true,
},
{
path: '/dashboard',
name: 'DashboardView',
component: () => import('@/components/dashboard/Dashboard.vue'),
props: true,
},
{
path: '/court-file-search',
name: 'CourtFileSearchView',
component: () =>
import('@/components/courtfilesearch/CourtFileSearchView.vue'),
},
];
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
});
router.beforeEach((to, from, next) => {
if (to.path === '/') {
next();
} else {
authGuard(to, from, next);
}
});
export default router;