taxios check refreshtoken condition

This commit is contained in:
hyunwoo93.cha
2024-07-10 16:11:45 +09:00
parent ee41ef24bd
commit e839677d66

View File

@@ -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 (baseUrl === URLS.GET_RE_AUTHENTICATION_CODE) {
dispatch(getAuthenticationCode());
} else {
if (!tokenRefreshing) {
dispatch(getAuthenticationCode());
}
checkAccessToken().then((token) => {
executeRequest(token);
});
}
return;
}
// 602 요청 국가 불일치