-
-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathrouter.js
145 lines (139 loc) Β· 3.14 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright (c) 2020-2024. The Nextcloud Bookmarks contributors.
*
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
*/
import Vue from 'vue'
import Router from 'vue-router'
import { generateUrl } from '@nextcloud/router'
const ViewPrivate = () => import(/* webpackPreload: true */ './components/ViewPrivate.vue')
const ViewPublic = () => import(/* webpackPreload: true */'./components/ViewPublic.vue')
const ViewBookmarklet = () => import(/* webpackPreload: true */'./components/ViewBookmarklet.vue')
Vue.use(Router)
export const privateRoutes = {
HOME: 'home',
RECENT: 'recent',
SEARCH: 'search',
FOLDER: 'folder',
BOOKMARK: 'bookmark',
TAGS: 'tags',
UNTAGGED: 'untagged',
UNAVAILABLE: 'UNAVAILABLE',
ARCHIVED: 'ARCHIVED',
BOOKMARKLET: 'bookmarklet',
SHARED_FOLDERS: 'SHARED_FOLDERS',
DUPLICATED: 'DUPLICATED',
TRASHBIN: 'TRASHBIN',
}
export const publicRoutes = {
HOME: 'public.home',
RECENT: 'public.recent',
SEARCH: 'public.search',
FOLDER: 'public.folder',
TAGS: 'public.tags',
UNTAGGED: 'public.untagged',
BOOKMARKLET: 'bookmarklet',
}
export default new Router({
mode: 'history',
base: generateUrl('/apps/bookmarks'),
linkActiveClass: 'active',
routes: [
{
path: '/',
name: privateRoutes.HOME,
component: ViewPrivate,
},
{
path: '/recent',
name: privateRoutes.RECENT,
component: ViewPrivate,
},
{
path: '/folders/:folder/search/:search',
name: privateRoutes.SEARCH,
component: ViewPrivate,
},
{
path: '/folders/:folder',
name: privateRoutes.FOLDER,
component: ViewPrivate,
},
{
path: '/bookmarks/:bookmark',
name: privateRoutes.BOOKMARK,
component: ViewPrivate,
},
{
path: '/tags/:tags?',
name: privateRoutes.TAGS,
component: ViewPrivate,
},
{
path: '/untagged',
name: privateRoutes.UNTAGGED,
component: ViewPrivate,
},
{
path: '/unavailable',
name: privateRoutes.UNAVAILABLE,
component: ViewPrivate,
},
{
path: '/archived',
name: privateRoutes.ARCHIVED,
component: ViewPrivate,
},
{
path: '/shared',
name: privateRoutes.SHARED_FOLDERS,
component: ViewPrivate,
},
{
path: '/duplicated',
name: privateRoutes.DUPLICATED,
component: ViewPrivate,
},
{
path: '/trashbin',
name: privateRoutes.TRASHBIN,
component: ViewPrivate,
},
{
path: '/bookmarklet',
name: privateRoutes.BOOKMARKLET,
component: ViewBookmarklet,
props: (route) => ({ url: route.query.url, title: route.query.title, folderId: route.query.folderId }),
},
{
path: '/public/:token',
name: publicRoutes.HOME,
component: ViewPublic,
},
{
path: '/public/:token/recent',
name: publicRoutes.RECENT,
component: ViewPublic,
},
{
path: '/public/:token/folder/:folder/search/:search',
name: publicRoutes.SEARCH,
component: ViewPublic,
},
{
path: '/public/:token/folder/:folder',
name: publicRoutes.FOLDER,
component: ViewPublic,
},
{
path: '/public/:token/tags/:tags',
name: publicRoutes.TAGS,
component: ViewPublic,
},
{
path: '/public/:token/untagged',
name: publicRoutes.UNTAGGED,
component: ViewPublic,
},
],
})