File size: 864 Bytes
7015ba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

import NotFoundVue from '@/views/404/index.vue';
import WelcomeVue from '@/views/Home/index.vue';
import SettingsVue from '@/views/Settings/index.vue';

const routes: Array<RouteRecordRaw> = [
  {
    name:"home",
    path: '/',
    component: WelcomeVue,
    meta: {
      requiresAgreement: false,
    }
  },
  {
    name:"settings",
    path:'/settings',
    component: SettingsVue,
  },
  {
    name:"404",
    path:'/404',
    component: NotFoundVue,
  }
];

const router = createRouter({
  // history: createWebHistory(),
  history: createWebHistory('/app/'),
  routes,
});

router.beforeEach((to, from, next) => {
  console.log('=============== router to : ', to)
  if (to.matched.length === 0) {
    next({ name: '404' });
  } else {
    next();
  }
});

export default router;