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