2 import Router
from "vue-router";
3 import Hall
from "./views/Hall.vue";
7 function loadView(view
) {
8 return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
11 import { ajax
} from "@/utils/ajax";
12 import { store
} from "@/store";
14 export default new Router({
24 component: loadView("Variants"),
27 path: "/variants/:vname([a-zA-Z0-9]+)",
29 component: loadView("Rules"),
32 path: "/authenticate/:token",
34 beforeEnter: (to
, from, next
) => {
35 console
.log("ajax call authenticate");
39 {token: to
.params
["token"]},
42 store
.state
.user
.id
= res
.id
;
43 store
.state
.user
.name
= res
.name
;
44 store
.state
.user
.email
= res
.email
;
45 store
.state
.user
.notify
= res
.notify
;
46 // NOTE: mysid isn't cleared (required for potential game continuation)
56 beforeEnter: (to
, from, next
) => {
61 store
.state
.user
.id
= 0;
62 store
.state
.user
.name
= "";
63 store
.state
.user
.email
= "";
64 store
.state
.user
.notify
= false;
74 // // route level code-splitting
75 // // this generates a separate chunk (about.[hash].js) for this route
76 // // which is lazy-loaded when the route is visited.
77 // component: loadView('About'),
79 // // return import(/* webpackChunkName: "about" */ "./views/About.vue");
82 // TODO: gameRef, problemId: https://router.vuejs.org/guide/essentials/dynamic-matching.html