Flesh out a bit more of the import and also refactor the router
This commit is contained in:
@@ -115,22 +115,20 @@ router.beforeEach(async (to, from, next) => {
|
||||
const publicPages = ["/start", "/account", "/import-account"];
|
||||
const isPublic = publicPages.includes(to.path);
|
||||
const appStore = useAppStore();
|
||||
let return_path = "/start";
|
||||
if (to.path === "/" && appStore.condition == "registered") {
|
||||
return_path = "/account";
|
||||
}
|
||||
if (isPublic) {
|
||||
console.log(to);
|
||||
if (to.path === "/" && appStore.condition === "registered") {
|
||||
next({ path: "/account" });
|
||||
} else if (isPublic) {
|
||||
switch (appStore.condition) {
|
||||
case "uninitialized":
|
||||
return_path = "";
|
||||
break;
|
||||
case "registered":
|
||||
next();
|
||||
break;
|
||||
default:
|
||||
next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (return_path == "") {
|
||||
return;
|
||||
} else if (appStore.condition === "uninitialized") {
|
||||
next({ path: "/start" });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user