-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathrouter.js
45 lines (42 loc) · 1.08 KB
/
router.js
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
import Vue from 'vue';
import Router from 'vue-router';
import AuthView from './views/AuthView';
import HomeView from './views/HomeView';
import OrgView from './views/OrgView';
import Upload from "./views/Upload.vue";
import AuthService from './services/authService';
Vue.use(Router);
const authService = new AuthService();
export default new Router({
routes: [{
path: '',
redirect: 'auth'
},
{
path: "/upload",
name: "Upload",
component: Upload
},
{
path: '/auth',
name: 'authView',
component: AuthView
},
{
path: '/home',
name: 'homeView',
component: HomeView,
beforeEnter: (to, from, next) => {
next(authService.isLoggedIn());
}
},
{
path: '/org/:name',
name: 'orgView',
component: OrgView,
beforeEnter: (to, from, next) => {
next(authService.isLoggedIn());
}
}
]
});