-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
130 lines (125 loc) · 2.6 KB
/
index.js
File metadata and controls
130 lines (125 loc) · 2.6 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';
import Signup from '../views/Signup.vue';
import Apply from '../views/Apply.vue';
import Status from '../views/Status.vue';
import Fees from '../views/Fees.vue';
import Background from '../views/Background.vue';
import Essays from '../views/Essays.vue';
import JCEssays from '../views/JCEssays.vue';
import Login from '../views/Login.vue';
import ParentInformation from '../views/ParentInformation.vue';
import PersonalStatement from '../views/PersonalStatement.vue';
import Recommendation from '../views/Recommendation.vue';
import Attachments from '../views/Attachments.vue';
import Solutions from '../views/Solutions.vue';
import Transcript from '../views/Transcript.vue';
import SubmitApplication from '../views/SubmitApplication.vue';
import store from '../store';
Vue.use(VueRouter);
const routes = [
{
path: '/',
name: 'home',
component: Home,
},
{
path: '/signup',
name: 'signup',
component: Signup,
},
{
path: '/login',
name: 'login',
component: Login,
},
{
path: '/apply',
name: 'apply',
component: Apply,
},
{
path: '/status',
name: 'status',
component: Status,
meta: {
requiresAuth: true,
},
},
{
path: '/fees',
name: 'fees',
component: Fees,
meta: {
requiresAuth: true,
},
},
{
path: '/apply/essays',
name: 'essays',
component: Essays,
},
{
path: '/apply/jc-essays',
name: 'jc-essays',
component: JCEssays,
},
{
path: '/apply/background',
name: 'background',
component: Background,
},
{
path: '/apply/statement',
name: 'statement',
component: PersonalStatement,
},
{
path: '/apply/recommendation',
name: 'recommendation',
component: Recommendation,
},
{
path: '/apply/solutions',
name: 'solutions',
component: Solutions,
},
{
path: '/apply/transcript',
name: 'transcript',
component: Transcript,
},
{
path: '/apply/attachments',
name: 'attachments',
component: Attachments,
},
{
path: '/apply/parent',
name: 'parent',
component: ParentInformation,
},
{
path: '/apply/submit',
name: 'submit',
component: SubmitApplication,
},
];
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes,
});
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
if (store.state.profile) {
next();
return;
}
next('/login');
} else {
next();
}
});
export default router;