Skip to content

Commit

Permalink
Merge pull request #142 from prgrms-web-devcourse/fix/common/utilrout…
Browse files Browse the repository at this point in the history
…e_to_courts

🐛 fix: UtilRoute 기본 privateRedirectPath 변경 #138
  • Loading branch information
Jonghyeon authored Dec 19, 2021
2 parents 02730da + aa99ddb commit 43a718c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/UtilRoute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const UtilRouteHOCWrapper = ({
option: RouteOptionUnion;
children: ReactNode;
}) => {
// TODO: Version2에서 private / prevented RedirectPath Props로 받아오도록 변경하기
const privateRedirectPath = "/courts";
const preventedRedirectPath = "/";

const [localToken] = useLocalToken();
const router = useRouter();

Expand All @@ -42,12 +46,12 @@ const UtilRouteHOCWrapper = ({
if (localToken) {
router.replace({ pathname: `${pathname}`, query: router.query });
} else {
router.replace("/login");
router.replace(privateRedirectPath);
}
break;
case routeOption.prevented:
if (localToken) {
router.replace("/");
router.replace(preventedRedirectPath);
} else {
router.replace({ pathname: `${pathname}`, query: router.query });
}
Expand Down

0 comments on commit 43a718c

Please sign in to comment.