index.ts
3.99 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import AuthLayout from '../layouts/AuthLayout.vue'
import AppLayout from '../layouts/AppLayout.vue'
import RouteViewComponent from '../layouts/RouterBypass.vue'
const routes: Array<RouteRecordRaw> = [
{
path: '/:pathMatch(.*)*',
redirect: { name: 'login' },
},
{
name: 'admin',
path: '/',
component: AppLayout,
redirect: { name: 'login' },
children: [
{
name: 'dashboard',
path: 'dashboard',
component: () => import('../pages/admin/dashboard/Dashboard.vue'),
},
{
name: 'settings',
path: 'settings',
component: () => import('../pages/settings/Settings.vue'),
},
{
name: 'preferences',
path: 'preferences',
component: () => import('../pages/preferences/Preferences.vue'),
},
{
name: 'users',
path: 'users',
component: () => import('../pages/users/UsersPage.vue'),
},
{
name: 'maps',
path: 'maps',
component: () => import('../pages/maps/MapPage.vue'),
},
{
name: 'map-editor',
path: 'maps/editor/:id?',
component: () => import('../pages/maps/MapEditor.vue'),
},
{
name: 'robots',
path: 'robots',
component: () => import('../pages/robots/RobotPage.vue'),
},
{
name: 'action-configurations',
path: 'action-configurations',
component: () => import('../pages/action-configuration/ActionConfigurationPage.vue'),
},
{
name: 'task-templates',
path: 'task-templates',
component: () => import('../pages/task-template/TaskTemplatePage.vue'),
},
{
name: 'robot-tasks',
path: 'robot-tasks',
component: () => import('../pages/robot-tasks/RobotTaskPage.vue'),
},
{
name: 'projects',
path: 'projects',
component: () => import('../pages/projects/ProjectsPage.vue'),
},
{
name: 'payments',
path: '/payments',
component: RouteViewComponent,
children: [
{
name: 'payment-methods',
path: 'payment-methods',
component: () => import('../pages/payments/PaymentsPage.vue'),
},
{
name: 'billing',
path: 'billing',
component: () => import('../pages/billing/BillingPage.vue'),
},
{
name: 'pricing-plans',
path: 'pricing-plans',
component: () => import('../pages/pricing-plans/PricingPlans.vue'),
},
],
},
{
name: 'faq',
path: '/faq',
component: () => import('../pages/faq/FaqPage.vue'),
},
],
},
{
path: '/auth',
component: AuthLayout,
children: [
{
name: 'login',
path: 'login',
component: () => import('../pages/auth/Login.vue'),
},
{
name: 'signup',
path: 'signup',
component: () => import('../pages/auth/Signup.vue'),
},
{
name: 'recover-password',
path: 'recover-password',
component: () => import('../pages/auth/RecoverPassword.vue'),
},
{
name: 'recover-password-email',
path: 'recover-password-email',
component: () => import('../pages/auth/CheckTheEmail.vue'),
},
{
path: '',
redirect: { name: 'login' },
},
],
},
{
name: '404',
path: '/404',
component: () => import('../pages/404.vue'),
},
]
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
}
// For some reason using documentation example doesn't scroll on page navigation.
if (to.hash) {
return { el: to.hash, behavior: 'smooth' }
} else {
window.scrollTo(0, 0)
}
},
routes,
})
export default router