fix getHomeTerms api infinite call
This commit is contained in:
@@ -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