From e839677d666f6ad3610af845be8570103a4dbf7d Mon Sep 17 00:00:00 2001 From: "hyunwoo93.cha" Date: Wed, 10 Jul 2024 16:11:45 +0900 Subject: [PATCH] taxios check refreshtoken condition --- com.twin.app.shoptime/src/api/TAxios.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/com.twin.app.shoptime/src/api/TAxios.js b/com.twin.app.shoptime/src/api/TAxios.js index c8fe3633..e344e9ba 100644 --- a/com.twin.app.shoptime/src/api/TAxios.js +++ b/com.twin.app.shoptime/src/api/TAxios.js @@ -18,6 +18,8 @@ import { ACTIVE_POPUP } from "../utils/Config"; import * as HelperMethods from "../utils/helperMethods"; import { getUrl, URLS } from "./apiConfig"; +const retryCount = 0; +const MAX_COUNT = 10; let tokenRefreshing = false; export const setTokenRefreshing = (value) => { console.log("TAxios setTokenRefreshing ", value); @@ -133,14 +135,19 @@ export const TAxios = ( }); return; } + //RefreshToken 만료 if (res?.data?.retCode === 402 || res?.data?.retCode === 501) { - if (!tokenRefreshing) { + if (baseUrl === URLS.GET_RE_AUTHENTICATION_CODE) { dispatch(getAuthenticationCode()); + } else { + if (!tokenRefreshing) { + dispatch(getAuthenticationCode()); + } + checkAccessToken().then((token) => { + executeRequest(token); + }); } - checkAccessToken().then((token) => { - executeRequest(token); - }); return; } // 602 요청 국가 불일치