projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix email formatting (I think)
[vchess.git]
/
client
/
src
/
router.js
diff --git
a/client/src/router.js
b/client/src/router.js
index
380ccc6
..
599cfcb
100644
(file)
--- a/
client/src/router.js
+++ b/
client/src/router.js
@@
-5,7
+5,7
@@
import Hall from "./views/Hall.vue";
Vue.use(Router);
function loadView(view) {
Vue.use(Router);
function loadView(view) {
-
return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
+ return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
}
import { ajax } from "@/utils/ajax";
}
import { ajax } from "@/utils/ajax";
@@
-46,24
+46,35
@@
const router = new Router({
localStorage["myname"] = res.name;
localStorage["myid"] = res.id;
}
localStorage["myname"] = res.name;
localStorage["myid"] = res.id;
}
- next("/");
+ // TODO: I don't like these 2 lines, "next('/')" should be enough
+ window.location = "/";
+ next();
}
);
},
component: Hall,
//redirect: "/", //problem: redirection before end of AJAX request
},
}
);
},
component: Hall,
//redirect: "/", //problem: redirection before end of AJAX request
},
+ {
+ path: "/mygames",
+ name: "mygames",
+ component: loadView("MyGames"),
+ },
{
path: "/game/:id",
name: "game",
component: loadView("Game"),
},
{
path: "/game/:id",
name: "game",
component: loadView("Game"),
},
+ {
+ path: "/analyze/:vname([a-zA-Z0-9]+)",
+ name: "analyze",
+ component: loadView("Analyze"),
+ },
{
path: "/about",
name: "about",
component: loadView("About"),
},
{
path: "/about",
name: "about",
component: loadView("About"),
},
- // TODO: myGames, problemId: https://router.vuejs.org/guide/essentials/dynamic-matching.html
]
});
]
});
@@
-75,9
+86,6
@@
router.beforeEach((to, from, next) => {
store.state.conn.send(JSON.stringify({code: "pagechange", page: to.path}));
}
next();
store.state.conn.send(JSON.stringify({code: "pagechange", page: to.path}));
}
next();
- // TODO?: redirect to current game (through GameStorage.getCurrent()) if any?
- // (and if the URL doesn't already match it) (use next("/game/GID"))
- //https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards
});
export default router;
});
export default router;