From 24bb22277f4c47c18697b69fcebdb21a6feed590 Mon Sep 17 00:00:00 2001
From: Dobbymin <gmin990624@gmail.com>
Date: Fri, 15 Nov 2024 03:55:02 +0900
Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20isSinitto=20=EC=86=8D=EC=84=B1?=
 =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?=
 =?UTF-8?q?=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../components/protected-route/ProtectedRoute.tsx  |  2 +-
 .../common/dummy-redirect/DummyRedirectPage.tsx    | 14 ++++++++------
 .../redirect-section/RedirectSection.tsx           |  2 +-
 src/shared/utils/storage/authStorage.ts            |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

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 <Navigate to={RouterPath.ROOT} />;
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/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 = <T extends keyof StorageKey>(

From 220236a493b0664f82d50ce766d2480ca6f76712 Mon Sep 17 00:00:00 2001
From: Dobbymin <gmin990624@gmail.com>
Date: Fri, 15 Nov 2024 04:01:22 +0900
Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20isSinitto=20=EC=86=8D=EC=84=B1=20str?=
 =?UTF-8?q?ing=EC=9C=BC=EB=A1=9C=20=EB=B3=80=ED=99=98=20=ED=9B=84=20authSt?=
 =?UTF-8?q?orage=20=EC=A0=80=EC=9E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/pages/common/register/ui/RegisterPage.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
   };