diff --git a/src/app/routes/components/protected-route/ProtectedRoute.tsx b/src/app/routes/components/protected-route/ProtectedRoute.tsx index 9ddb8fc..7723328 100644 --- a/src/app/routes/components/protected-route/ProtectedRoute.tsx +++ b/src/app/routes/components/protected-route/ProtectedRoute.tsx @@ -11,7 +11,7 @@ type Props = { const ProtectedRoute = ({ requiresAuth, sinittoOnly, guardOnly }: Props) => { const accessToken = authStorage.accessToken.get(); - const isSinitto = authStorage.isSinitto.get() === true; + const isSinitto = authStorage.isSinitto.get() === 'true'; if (requiresAuth && !accessToken) { return ; diff --git a/src/pages/common/dummy-redirect/DummyRedirectPage.tsx b/src/pages/common/dummy-redirect/DummyRedirectPage.tsx index 29b4706..fde3979 100644 --- a/src/pages/common/dummy-redirect/DummyRedirectPage.tsx +++ b/src/pages/common/dummy-redirect/DummyRedirectPage.tsx @@ -19,26 +19,28 @@ export const DummyRedirectPage = () => { const refreshToken = params.get('refreshToken'); const isSinitto = params.get('isSinitto'); - if (accessToken && refreshToken && isSinitto) { + if (accessToken && refreshToken && isSinitto !== null) { // 로컬 스토리지에 토큰 저장 authStorage.accessToken.set(accessToken); authStorage.refreshToken.set(refreshToken); - authStorage.isSinitto.set(isSinitto === 'true'); + authStorage.isSinitto.set(isSinitto); // isSinitto 상태에 따른 메시지 설정 setStatusMessage( - isSinitto === 'true' + isSinitto ? '시니또 더미데이터로 로그인 중입니다. 페이지 이동 중...' : '보호자 더미데이터로 로그인 중입니다. 페이지 이동 중...' ); setTimeout(() => { setIsLoading(false); // 로딩 완료 - navigate(isSinitto === 'true' ? RouterPath.SINITTO : RouterPath.GUARD); + navigate(isSinitto ? RouterPath.SINITTO : RouterPath.GUARD); }, 2000); } else { - console.error('Access or Refresh token not found in query parameters.'); - setStatusMessage('[ERROR] 토큰이 존재하지 않습니다.'); + console.error( + 'Access or Refresh token not found in query parameters or isSinitto is invalid.' + ); + setStatusMessage('[ERROR] 유효하지 않은 토큰 또는 파라미터입니다.'); setIsLoading(false); } diff --git a/src/pages/common/redirect/components/redirect-section/RedirectSection.tsx b/src/pages/common/redirect/components/redirect-section/RedirectSection.tsx index 8f2a4d9..753c7bf 100644 --- a/src/pages/common/redirect/components/redirect-section/RedirectSection.tsx +++ b/src/pages/common/redirect/components/redirect-section/RedirectSection.tsx @@ -25,7 +25,7 @@ const RedirectSection = ({ code }: Props) => { authStorage.accessToken.set(accessToken); authStorage.refreshToken.set(refreshToken); - authStorage.isSinitto.set(isSinitto); + authStorage.isSinitto.set(isSinitto.toString()); setEmail(data.email); diff --git a/src/pages/common/register/ui/RegisterPage.tsx b/src/pages/common/register/ui/RegisterPage.tsx index 66824db..119a6ef 100644 --- a/src/pages/common/register/ui/RegisterPage.tsx +++ b/src/pages/common/register/ui/RegisterPage.tsx @@ -41,7 +41,7 @@ const RegisterPage = () => { isSinitto, }; - authStorage.isSinitto.set(requestData.isSinitto); + authStorage.isSinitto.set(requestData.isSinitto.toString()); mutation.mutate(requestData); }; diff --git a/src/shared/utils/storage/authStorage.ts b/src/shared/utils/storage/authStorage.ts index 41247a7..40f925c 100644 --- a/src/shared/utils/storage/authStorage.ts +++ b/src/shared/utils/storage/authStorage.ts @@ -1,7 +1,7 @@ type StorageKey = { accessToken?: string; refreshToken?: string; - isSinitto?: boolean; + isSinitto?: string; }; const initStorage = (