summaryrefslogtreecommitdiffstats
path: root/settings/src/router.js
blob: bfcff91e992ed110c86b7a18b1d9923ee377bbf8 (plain)
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
import Vue from 'vue';
import Router from 'vue-router';
import Users from './views/Users';
import Apps from './views/Apps';

Vue.use(Router);

/*
 * This is the list of routes where the vuejs app will
 * take over php to provide data
 * You need to forward the php routing (routes.php) to
 * /settings/main.php, where the vue-router will ensure
 * the proper route.
 * ⚠️ Routes needs to match the php routes.
 */

export default new Router({
	mode: 'history',
	// if index.php is in the url AND we got this far, then it's working:
	// let's keep using index.php in the url
	base: OC.generateUrl(''),
	linkActiveClass: 'active',
	routes: [
		{
			path: '/:index(index.php/)?settings/users',
			component: Users,
			props: true,
			name: 'users',
			children: [
				{
					path: ':selectedGroup',
					name: 'group',
					component: Users
				}
			]
		},
		{
			path: '/:index(index.php/)?settings/apps',
			component: Apps,
			props: true,
			name: 'apps',
			children: [
				{
					path: ':category',
					name: 'apps-category',
					component: Apps,
					children: [
						{
							path: ':id',
							name: 'apps-details',
							component: Apps
						}
					]
				}
			]
		}
	]
});