From 1ab118899348385acea625b8a15bb4a2c8ca2fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=97=B0=EC=A7=84?= Date: Fri, 15 Aug 2025 22:48:59 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=91=B8=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axiosInstance.ts | 9 ++++----- src/components/layout/Footer.tsx | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/api/axiosInstance.ts b/src/api/axiosInstance.ts index 0d73257..b01c349 100644 --- a/src/api/axiosInstance.ts +++ b/src/api/axiosInstance.ts @@ -18,7 +18,7 @@ let isRedirecting = false; axiosInstance.interceptors.response.use( (response) => response, async (error) => { - if (error.response?.data.error === 'Unauthorized') { + if (error.status === 401) { if (isRedirecting) { return Promise.reject(error); } @@ -35,18 +35,17 @@ axiosInstance.interceptors.response.use( if (refreshResponse.code === '200') { isRedirecting = false; - return axiosInstance(error.config); } } catch (errors) { if (axios.isAxiosError(errors)) { const refreshError = errors as AxiosError; - if (refreshError.response?.data.message === 'The token is null.') { + if (refreshError.status === 401) { console.error('refreshToken이 없습니다. 로그인 페이지로 이동합니다.'); void logout(); localStorage.clear(); - } else if (refreshError.response?.data.message === 'The token is invalid.') { - console.error('refreshToken이 만료되었습니다. 로그인 페이지로 이동합니다.'); + } else if (refreshError.status === 404) { + console.error('사용자 정보를 찾지 못했습니다. 로그인 페이지로 이동합니다.'); void logout(); localStorage.clear(); } else { diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx index 97712fa..f800764 100644 --- a/src/components/layout/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -7,7 +7,7 @@ export default function Footer() { {/* 상단 */}