-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
31 lines (28 loc) · 1.13 KB
/
router.js
File metadata and controls
31 lines (28 loc) · 1.13 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
import {createRouter, createWebHistory} from 'vue-router';
import NotFoundComponent from './components/NotFound.vue';
import StatisticsComponent from './components/Statistics.vue';
import AboutComponent from './components/About.vue';
import LoginFormComponent from './components/LoginForm.vue';
import RegisterFormComponent from './components/RegisterForm.vue';
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: null },
{ path: '/search/:searchTerm', component: null },
{ path: '/refresh', component: null },
{ path: '/statistics', component: StatisticsComponent },
{ path: '/about', component: AboutComponent },
{ path: '/register', component: RegisterFormComponent },
{ path: '/login', component: LoginFormComponent },
{ path: '/logout', redirect: '/' },
{ path: '/:notFound(.*)', component: NotFoundComponent }
],
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { left: 0, top: 0 };
}
}
});
export default router;