fix getHomeTerms api infinite call
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { URLS } from "../api/apiConfig";
|
||||
import { TAxios } from "../api/TAxios";
|
||||
import { types } from "./actionTypes";
|
||||
import { changeAppStatus, getTermsAgreeYn } from "./commonActions";
|
||||
import { URLS } from '../api/apiConfig';
|
||||
import { TAxios } from '../api/TAxios';
|
||||
import { types } from './actionTypes';
|
||||
import {
|
||||
changeAppStatus,
|
||||
getTermsAgreeYn,
|
||||
} from './commonActions';
|
||||
|
||||
// 약관 정보 조회 IF-LGSP-005
|
||||
export const getHomeTerms = (props) => (dispatch, getState) => {
|
||||
@@ -10,7 +13,7 @@ export const getHomeTerms = (props) => (dispatch, getState) => {
|
||||
const onSuccess = (response) => {
|
||||
console.log("getHomeTerms onSuccess ", response.data);
|
||||
|
||||
if(response.data.retCode === 0){
|
||||
if (response.data.retCode === 0) {
|
||||
dispatch({
|
||||
type: types.GET_HOME_TERMS,
|
||||
payload: response.data,
|
||||
@@ -33,8 +36,7 @@ export const getHomeTerms = (props) => (dispatch, getState) => {
|
||||
{ trmsTpCdList, mbrNo },
|
||||
{},
|
||||
onSuccess,
|
||||
onFail,
|
||||
true
|
||||
onFail
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ 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 retryCount = 0;
|
||||
let tokenRefreshing = false;
|
||||
|
||||
export const setTokenRefreshing = (value) => {
|
||||
console.log("TAxios setTokenRefreshing ", value);
|
||||
tokenRefreshing = value;
|
||||
@@ -42,10 +42,16 @@ export const TAxios = (
|
||||
const accessToken = getState().localSettings.accessToken;
|
||||
if (noTokenRefresh || (!tokenRefreshing && accessToken)) {
|
||||
resolve(accessToken);
|
||||
retryCount = 0;
|
||||
} else {
|
||||
if (!accessToken && !tokenRefreshing) {
|
||||
dispatch(getAuthenticationCode());
|
||||
}
|
||||
retryCount++;
|
||||
if (retryCount > 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
HelperMethods.wait(100).then(() => {
|
||||
resolve(checkAccessToken());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user