From 877c718c73caf91d578430740ebe05c4d6b4db80 Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Wed, 13 Nov 2024 16:45:21 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Fix]=20-=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/Login.jsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/pages/login/Login.jsx b/src/pages/login/Login.jsx index b1ce9db..ecfb900 100644 --- a/src/pages/login/Login.jsx +++ b/src/pages/login/Login.jsx @@ -19,10 +19,23 @@ export const Login = () => { const { form, handleChange, isValid } = useForm(loginState); const navigate = useNavigate(); - const handleLogin = async () => { - await postLogin(form); - await getUUID(); - navigate(`/nugu/${Cookies.get("uuid")}`); + const performAPI = async () => { + try { + await postLogin(form); + await getUUID(); + const uuid = Cookies.get("uuid"); + if (uuid) { + navigate(`/nugu/${uuid}`); + } else { + console.error("UUID를 찾을 수 없습니다."); + } + } catch (error) { + console.error("로그인 요청 중 에러가 발생했습니다:", error); + } + }; + + const handleLogin = () => { + performAPI(); }; return ( From 542287058f62d1c9052a43764453333256448faf Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Wed, 13 Nov 2024 16:47:14 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[Test]=20-=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=9F=AC=EB=B8=94=20=EC=8A=88=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/Login.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/login/Login.jsx b/src/pages/login/Login.jsx index ecfb900..c3f212e 100644 --- a/src/pages/login/Login.jsx +++ b/src/pages/login/Login.jsx @@ -22,13 +22,13 @@ export const Login = () => { const performAPI = async () => { try { await postLogin(form); - await getUUID(); - const uuid = Cookies.get("uuid"); - if (uuid) { - navigate(`/nugu/${uuid}`); - } else { - console.error("UUID를 찾을 수 없습니다."); - } + // await getUUID(); + // const uuid = Cookies.get("uuid"); + // if (uuid) { + // navigate(`/nugu/${uuid}`); + // } else { + // console.error("UUID를 찾을 수 없습니다."); + // } } catch (error) { console.error("로그인 요청 중 에러가 발생했습니다:", error); } From 76aa40423c96a933c5f8c949211a705a9e554d80 Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Wed, 13 Nov 2024 16:49:27 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[Test]=20-=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=9F=AC=EB=B8=94=20=EC=8A=88=ED=8C=85=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/login.js | 4 ---- src/pages/login/Login.jsx | 14 +++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/apis/login.js b/src/apis/login.js index bea18f9..a36784c 100644 --- a/src/apis/login.js +++ b/src/apis/login.js @@ -1,9 +1,6 @@ import { instance } from "./instance"; import Cookies from "js-cookie"; -import { useNavigate } from "react-router-dom"; export const postLogin = async (form) => { - const navigate = useNavigate(); - try { const response = await instance.post("/login", { ...form, @@ -17,7 +14,6 @@ export const postLogin = async (form) => { secure: true, sameSite: "Strict", }); - navigate("/nugu/admin"); } } catch (err) { throw err; diff --git a/src/pages/login/Login.jsx b/src/pages/login/Login.jsx index c3f212e..ecfb900 100644 --- a/src/pages/login/Login.jsx +++ b/src/pages/login/Login.jsx @@ -22,13 +22,13 @@ export const Login = () => { const performAPI = async () => { try { await postLogin(form); - // await getUUID(); - // const uuid = Cookies.get("uuid"); - // if (uuid) { - // navigate(`/nugu/${uuid}`); - // } else { - // console.error("UUID를 찾을 수 없습니다."); - // } + await getUUID(); + const uuid = Cookies.get("uuid"); + if (uuid) { + navigate(`/nugu/${uuid}`); + } else { + console.error("UUID를 찾을 수 없습니다."); + } } catch (error) { console.error("로그인 요청 중 에러가 발생했습니다:", error); } From cee22be8536df3f458b20db3a56c5983af0bb3a1 Mon Sep 17 00:00:00 2001 From: sayyyho <323psh@naver.com> Date: Wed, 13 Nov 2024 16:53:10 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Fix]=20-=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/nugu/{NuguAdmin.jsx => Nugu.jsx} | 2 +- src/pages/nugu/NuguGuest.jsx | 0 src/router.jsx | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/pages/nugu/{NuguAdmin.jsx => Nugu.jsx} (97%) delete mode 100644 src/pages/nugu/NuguGuest.jsx diff --git a/src/pages/nugu/NuguAdmin.jsx b/src/pages/nugu/Nugu.jsx similarity index 97% rename from src/pages/nugu/NuguAdmin.jsx rename to src/pages/nugu/Nugu.jsx index eadaa14..c2211e9 100644 --- a/src/pages/nugu/NuguAdmin.jsx +++ b/src/pages/nugu/Nugu.jsx @@ -6,7 +6,7 @@ import { Chip } from "@components/chip/Chip"; import { useParams } from "react-router-dom"; import { useNuguInfo } from "./_hooks/useNuguInfo"; -export const NuguAdmin = () => { +export const Nugu = () => { const { uuid } = useParams(); const { data, isAdmin } = useNuguInfo(uuid); return ( diff --git a/src/pages/nugu/NuguGuest.jsx b/src/pages/nugu/NuguGuest.jsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/router.jsx b/src/router.jsx index 4fd8db9..dec7041 100644 --- a/src/router.jsx +++ b/src/router.jsx @@ -8,7 +8,7 @@ import { SignUpSubmit } from "@pages/signUp/SignUpSubmit"; import { NuguIntro } from "@pages/nuguIntro/NuguIntro"; import { WriteIntro } from "@pages/nuguIntro/WriteIntro"; import { NuguCreate } from "@pages/signUp/NuguCreate"; -import { NuguAdmin } from "@pages/nugu/NuguAdmin"; +import { Nugu } from "@pages/nugu/Nugu"; import { NuguTestPage } from "@pages/nuguTest/NuguTest"; import { MakeNuguTest } from "@pages/nuguTest/MakeNuguTest"; import { NuguChallenge } from "@pages/nuguTest/NuguChallenge"; @@ -67,7 +67,7 @@ const router = createBrowserRouter([ }, { path: "/nugu/:uuid", - element: , + element: , }, ], },