Draft of problems section
[vchess.git] / client / src / router.js
index daa9619..071af8c 100644 (file)
@@ -38,13 +38,18 @@ const router = new Router({
       name: "logout",
       component: loadView("Logout"),
     },
+    {
+      path: "/problems",
+      name: "myproblems",
+      component: loadView("Problems"),
+    },
     {
       path: "/mygames",
       name: "mygames",
       component: loadView("MyGames"),
     },
     {
-      path: "/game/:id",
+      path: "/game/:id([a-zA-Z0-9]+)",
       name: "game",
       component: loadView("Game"),
     },
@@ -61,14 +66,4 @@ const router = new Router({
   ]
 });
 
-router.beforeEach((to, from, next) => {
-  window.scrollTo(0, 0);
-  if (!!store.state.conn) //uninitialized at first page
-  {
-    // Notify WebSockets server (TODO: path or fullPath?)
-    store.state.conn.send(JSON.stringify({code: "pagechange", page: to.path}));
-  }
-  next();
-});
-
 export default router;