-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
97 lines (88 loc) · 2.78 KB
/
routes.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
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
import MailIndex from './apps/gmail/pages/MailIndex.js'
import KeepIndex from './apps/keep/pages/KeepIndex.js'
import HomePage from './pages/HomePage.js'
import MailList from './apps/gmail/cmps/MailList.js'
import MailDetails from './apps/gmail/pages/MailDetails.js'
import NoteDetails from './apps/keep/pages/NoteDetails.js'
import YouTubeIndex from './apps/youtube/pages/YouTubeIndex.js'
import CanvasEditor from './apps/keep/cmps/CanvasEditor.js'
import YtWatch from './apps/youtube/pages/YtWatch.js'
import YtLibrary from './apps/youtube/pages/VidLibrary.js'
import { utilService } from './services/util.service.js'
const { createRouter, createWebHashHistory } = VueRouter
const options = {
history: createWebHashHistory(),
routes: [
{
path: '/',
component: () => HomePage,
name: 'home'
},
{
path: '/gmail',
component: MailIndex,
name: 'gmail',
children: [
{
path: '/mail',
component: MailList,
name: 'mail',
},
{
path: '/mail/:id',
component: MailDetails,
name: 'mail-details',
},
]
},
{
path: '/note',
component: () => KeepIndex,
name: 'note',
children: [
{
path: '/note/:id',
component: NoteDetails,
name: 'note-details',
},
{
path: '/note/canvas',
component: CanvasEditor,
name: 'note-canvas',
},
]
},
{
path: '/youtube',
component: YouTubeIndex,
redirect: '/youtube/watch',
name: 'youtube',
children: [
{
path: '/youtube/library',
component: YtLibrary,
name: 'youtube-vid-library',
},
{
path: '/youtube/watch',
component: YtWatch,
name: 'youtube-vid-watch',
}
]
},
]
}
export const router = createRouter(options)
export const routerHistory = []
router.beforeEach((to, from) => {
if (to.fullPath.includes('mail')) {
utilService.setAppConfig('gmail')
}
if (to.fullPath.includes('note')) {
utilService.setAppConfig('keep')
}
if (to.fullPath.includes('youtube')) {
utilService.setAppConfig('youtube')
}
routerHistory.push(to)
})