Skip to content

Commit

Permalink
fix: incorrect route
Browse files Browse the repository at this point in the history
  • Loading branch information
ChingCdesu committed Sep 30, 2023
1 parent 99918b9 commit b5ee414
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "supernode-frontend",
"private": true,
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.6",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
16 changes: 7 additions & 9 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@ const router = createRouter({

router.beforeEach((to, from, next) => {
if (to.path.startsWith("/api")) {
next();
return;
}
if (to.path === "/login") {
next();
return;
}
if (isExpired.value) {
return { path: "/login" };
} else {
getMe()
.then(() => {
next();
})
.catch(() => {
next({ path: "/login" });
});
next({ path: "/login" });
return;
}
getMe()
.then(() => next())
.catch(() => next({ path: "/login" }));
});

export default router;

0 comments on commit b5ee414

Please sign in to comment.