Skip to content

Commit

Permalink
fix: null 일 경우에만 리다이렉트 되도록 되어있어 undefined 상태에 대해 처리하지 않던 이슈 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
junman95 committed Dec 19, 2024
1 parent 2e7698a commit 6336eff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/network/router/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const STATIC_PAGES = {
path: "/profile",
guards: [
() => {
if (userStore.getUser() === null) return "/login";
if (!userStore.getUser()) return "/login";
},
],
page: ProfilePage,
Expand Down Expand Up @@ -60,7 +60,8 @@ class Router {
}
};

navigate = (path) => {
navigate = (path, redirect) => {
console.log("redirect", redirect, path);
if (this.isHash === true) {
window.location.hash = path;
}
Expand Down Expand Up @@ -100,7 +101,7 @@ class Router {
for (const guard of guards) {
const redirectPath = guard();
if (redirectPath) {
this.navigate(redirectPath);
this.navigate(redirectPath, true);
skip = true;
return;
}
Expand Down

0 comments on commit 6336eff

Please sign in to comment.