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