Commit | Line | Data |
---|---|---|
625022fd BA |
1 | import Vue from "vue"; |
2 | import Router from "vue-router"; | |
cf2343ce | 3 | import Hall from "./views/Hall.vue"; |
625022fd BA |
4 | |
5 | Vue.use(Router); | |
6 | ||
7 | function loadView(view) { | |
6808d7a1 BA |
8 | return () => |
9 | import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`); | |
625022fd BA |
10 | } |
11 | ||
786e0065 | 12 | const router = new Router({ |
625022fd BA |
13 | routes: [ |
14 | { | |
15 | path: "/", | |
cf2343ce | 16 | name: "hall", |
6808d7a1 | 17 | component: Hall |
625022fd | 18 | }, |
5b020e73 BA |
19 | { |
20 | path: "/variants", | |
21 | name: "variants", | |
6808d7a1 | 22 | component: loadView("Variants") |
5b020e73 | 23 | }, |
cf2343ce BA |
24 | { |
25 | path: "/variants/:vname([a-zA-Z0-9]+)", | |
26 | name: "rules", | |
6808d7a1 | 27 | component: loadView("Rules") |
cf2343ce | 28 | }, |
1aeed627 BA |
29 | { |
30 | path: "/authenticate/:token", | |
31 | name: "authenticate", | |
6808d7a1 | 32 | component: loadView("Auth") |
a3ac374b BA |
33 | }, |
34 | { | |
35 | path: "/logout", | |
36 | name: "logout", | |
6808d7a1 | 37 | component: loadView("Logout") |
1aeed627 | 38 | }, |
89021f18 BA |
39 | { |
40 | path: "/problems", | |
41 | name: "myproblems", | |
6808d7a1 | 42 | component: loadView("Problems") |
89021f18 | 43 | }, |
afd3240d BA |
44 | { |
45 | path: "/mygames", | |
46 | name: "mygames", | |
6808d7a1 | 47 | component: loadView("MyGames") |
afd3240d | 48 | }, |
f7121527 | 49 | { |
71468011 | 50 | path: "/game/:id([a-zA-Z0-9]+)", |
f7121527 | 51 | name: "game", |
6808d7a1 | 52 | component: loadView("Game") |
f7121527 | 53 | }, |
afd3240d | 54 | { |
677fe285 BA |
55 | path: "/analyse/:vname([a-zA-Z0-9]+)", |
56 | name: "analyse", | |
6808d7a1 | 57 | component: loadView("Analyse") |
afd3240d | 58 | }, |
92a523d1 BA |
59 | { |
60 | path: "/about", | |
61 | name: "about", | |
6808d7a1 | 62 | component: loadView("About") |
92a523d1 | 63 | }, |
604b951e BA |
64 | { |
65 | path: "/news", | |
66 | name: "news", | |
6808d7a1 BA |
67 | component: loadView("News") |
68 | } | |
625022fd BA |
69 | ] |
70 | }); | |
786e0065 | 71 | |
786e0065 | 72 | export default router; |