From b59d77c4d593910a449eba566caf4d0a09db2e68 Mon Sep 17 00:00:00 2001 From: YOOJS1205 Date: Sat, 3 Feb 2024 12:16:25 +0900 Subject: [PATCH] =?UTF-8?q?token=20refresh=20=EC=8B=A4=ED=8C=A8=ED=95=98?= =?UTF-8?q?=EB=A9=B4=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api-config.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/api/api-config.ts b/src/api/api-config.ts index 86fc4545..23c27703 100644 --- a/src/api/api-config.ts +++ b/src/api/api-config.ts @@ -2,11 +2,7 @@ import axios from 'axios'; import Cookies from 'js-cookie'; import { TOKEN_REFRESH_URL, LOGOUT_URL } from '@constants/endpoint'; -import { - getTokenRefresh, - logout, - removeTokenAndMoveToLogin, -} from '@utils/auth'; +import { getTokenRefresh, removeTokenAndMoveToLogin } from '@utils/auth'; type Method = 'get' | 'post' | 'put' | 'delete' | 'patch'; @@ -117,8 +113,8 @@ axiosInstance.interceptors.response.use( } // NOTE: 토큰 재발급 요청이 유효하지 않으면, 쿠키의 토큰을 삭제하고 로그아웃 처리. 로그인 페이지로 이동 - if (config.url === TOKEN_REFRESH_URL && response.data.code === 401) { - logout(); + if (config.url === TOKEN_REFRESH_URL && response.data.code === 400) { + removeTokenAndMoveToLogin(); } }, );