Fixes, improvements
[vchess.git] / client / src / router.js
1 import Vue from "vue";
2 import Router from "vue-router";
3 import Hall from "./views/Hall.vue";
4
5 Vue.use(Router);
6
7 function loadView(view) {
8 return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
9 }
10
11 import { ajax } from "@/utils/ajax";
12 import { store } from "@/store";
13
14 const router = new Router({
15 routes: [
16 {
17 path: "/",
18 name: "hall",
19 component: Hall,
20 },
21 {
22 path: "/variants",
23 name: "variants",
24 component: loadView("Variants"),
25 },
26 {
27 path: "/variants/:vname([a-zA-Z0-9]+)",
28 name: "rules",
29 component: loadView("Rules"),
30 },
31 {
32 path: "/authenticate/:token",
33 name: "authenticate",
34 component: loadView("Auth"),
35 },
36 {
37 path: "/logout",
38 name: "logout",
39 component: loadView("Logout"),
40 },
41 {
42 path: "/problems",
43 name: "myproblems",
44 component: loadView("Problems"),
45 },
46 {
47 path: "/mygames",
48 name: "mygames",
49 component: loadView("MyGames"),
50 },
51 {
52 path: "/game/:id([a-zA-Z0-9]+)",
53 name: "game",
54 component: loadView("Game"),
55 },
56 {
57 path: "/analyse/:vname([a-zA-Z0-9]+)",
58 name: "analyse",
59 component: loadView("Analyse"),
60 },
61 {
62 path: "/about",
63 name: "about",
64 component: loadView("About"),
65 },
66 {
67 path: "/news",
68 name: "news",
69 component: loadView("News"),
70 },
71 ]
72 });
73
74 export default router;