From e17e9db252b2f34e41b77a4b0b5d36917eb53795 Mon Sep 17 00:00:00 2001 From: yarimu Date: Mon, 11 Nov 2024 23:26:01 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=99=88=EC=9C=BC=EB=A1=9C=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=EC=8B=9C=20=EC=9D=B4=EB=8F=99=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/errorPage/ErrorPage.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/errorPage/ErrorPage.tsx b/src/pages/errorPage/ErrorPage.tsx index 903e3d59..cd765182 100644 --- a/src/pages/errorPage/ErrorPage.tsx +++ b/src/pages/errorPage/ErrorPage.tsx @@ -12,8 +12,20 @@ const ErrorPage = () => { const navigate = useNavigate(); const handleHomeBtn = () => { - localStorage.clear(); - navigate('/'); + const token = localStorage.getItem('seonyakToken'); + const role = localStorage.getItem('seonyakRole'); + + if (!token || !role) { + localStorage.clear(); + return navigate('/'); + } + + const routeMap: { [key: string]: string } = { + SENIOR: '/promiseList', + JUNIOR: '/juniorPromise', + }; + + navigate(routeMap[role] || '/'); }; const handleOpenUrl = (url: string) => window.open(url);