From 61e926852dbf08e32ae14876a5d651fae70c7ab1 Mon Sep 17 00:00:00 2001 From: Woorim Kim Date: Wed, 14 Feb 2024 10:45:34 +0900 Subject: [PATCH 1/2] fix/error handling for logout --- src/states/useAuthStore.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/states/useAuthStore.tsx b/src/states/useAuthStore.tsx index ff2172608..e22f5748d 100644 --- a/src/states/useAuthStore.tsx +++ b/src/states/useAuthStore.tsx @@ -41,12 +41,15 @@ const useAuthStore = create((set) => { })) }, logout: (isRefreshing) => { + console.log('isRefreshing: ', isRefreshing) if (authData.accessToken && !isRefreshing) { axios .get(`${API_URL}/api/v1/logout`, { headers: { Authorization: `Bearer ${authData.accessToken}`, }, + }).catch(()=>{ + // console.log('만료된 토큰') -- do nothing }) } LocalStorage.removeItem('authData') From 66472657a811147dd4f995445e376b13ff2c43e6 Mon Sep 17 00:00:00 2001 From: Woorim Kim Date: Wed, 14 Feb 2024 10:59:49 +0900 Subject: [PATCH 2/2] chore: delete console --- src/states/useAuthStore.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/states/useAuthStore.tsx b/src/states/useAuthStore.tsx index e22f5748d..4dbe2b17f 100644 --- a/src/states/useAuthStore.tsx +++ b/src/states/useAuthStore.tsx @@ -41,14 +41,14 @@ const useAuthStore = create((set) => { })) }, logout: (isRefreshing) => { - console.log('isRefreshing: ', isRefreshing) - if (authData.accessToken && !isRefreshing) { + if (authData.accessToken && isRefreshing === undefined) { axios .get(`${API_URL}/api/v1/logout`, { headers: { Authorization: `Bearer ${authData.accessToken}`, }, - }).catch(()=>{ + }) + .catch(() => { // console.log('만료된 토큰') -- do nothing }) }