NTP-14167 | Merge master
This commit is contained in:
@@ -107,6 +107,11 @@ export enum ApiKeys {
|
||||
GET_SIGNED_URL_V2 = 'GET_SIGNED_URL_V2',
|
||||
GET_SIGNED_URL_FOR_REPORTEE_V2 = 'GET_SIGNED_URL_FOR_REPORTEE_V2',
|
||||
ALL_ESCALATIONS = 'ALL_ESCALATIONS',
|
||||
GET_UNGROUPED_ADDRESSES = 'GET_UNGROUPED_ADDRESSES',
|
||||
GET_GROUPED_ADDRESSES_AND_GEOLOCATIONS = 'GET_GROUPED_ADDRESSES',
|
||||
GET_EMI_SCHEDULE = 'GET_EMI_SCHEDULE',
|
||||
GET_REPAYMENTS = 'GET_REPAYMENTS',
|
||||
GET_FEEDBACK_HISTORY = 'GET_FEEDBACK_HISTORY',
|
||||
}
|
||||
|
||||
export const API_URLS: Record<ApiKeys, string> = {} as Record<ApiKeys, string>;
|
||||
@@ -207,6 +212,13 @@ API_URLS[ApiKeys.GENERATE_DYNAMIC_DOCUMENT] = '/documents/generate/{loanAccountN
|
||||
API_URLS[ApiKeys.DOWNLOAD_LATEST_APP] = 'https://longhorn.navi.com/api/app/download';
|
||||
API_URLS[ApiKeys.ALL_ESCALATIONS] = '/customer-escalation';
|
||||
API_URLS[ApiKeys.DOWNLOAD_LATEST_APP] = 'https://longhorn.navi.com/api/app/download';
|
||||
API_URLS[ApiKeys.GET_UNGROUPED_ADDRESSES] =
|
||||
'/collection-cases/{loanAccountNumber}/ungrouped/addresses';
|
||||
API_URLS[ApiKeys.GET_GROUPED_ADDRESSES_AND_GEOLOCATIONS] =
|
||||
'/collection-cases/{loanAccountNumber}/grouped/addresses-geo-locations';
|
||||
API_URLS[ApiKeys.GET_EMI_SCHEDULE] = '/collection-cases/{loanAccountNumber}/emiSchedule';
|
||||
API_URLS[ApiKeys.GET_REPAYMENTS] = '/collection-cases/{loanAccountNumber}/repayments';
|
||||
API_URLS[ApiKeys.GET_FEEDBACK_HISTORY] = '/feedback/filters';
|
||||
|
||||
export const API_STATUS_CODE = {
|
||||
OK: 200,
|
||||
@@ -266,7 +278,7 @@ axiosInstance.interceptors.request.use((request) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
request.retry = request?.retry < 4 ? request.retry : 3;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
request.delay = request?.delay > 2000 ? request.delay : 2000;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
@@ -341,19 +353,19 @@ axiosInstance.interceptors.response.use(
|
||||
);
|
||||
if (
|
||||
config?.headers?.donotHandleError ||
|
||||
donotHandleErrorOnStatusCode.includes(error.response.status)
|
||||
donotHandleErrorOnStatusCode.includes(error?.response?.status)
|
||||
) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
if (!config || config.retry <= 1 || !errorsToRetry.includes(error.response.status)) {
|
||||
if (!config || config.retry <= 1 || !errorsToRetry.includes(error?.response?.status)) {
|
||||
const errorString = getErrorMessage(error);
|
||||
if (
|
||||
!config.headers.donotHandleError &&
|
||||
(config.headers?.showInSpecificComponents
|
||||
? config.headers.showInSpecificComponents?.includes(getCurrentScreen().name)
|
||||
? config.headers.showInSpecificComponents?.includes(getCurrentScreen()?.name)
|
||||
: true)
|
||||
) {
|
||||
if (API_STATUS_CODE.GONE !== response.status) {
|
||||
if (API_STATUS_CODE.GONE !== response?.status) {
|
||||
toast({
|
||||
type: 'error',
|
||||
text1: typeof errorString === 'string' ? errorString : API_ERROR_MESSAGE,
|
||||
@@ -361,18 +373,18 @@ axiosInstance.interceptors.response.use(
|
||||
}
|
||||
}
|
||||
|
||||
if ([API_STATUS_CODE.UNAUTHORIZED, API_STATUS_CODE.FORBIDDEN].includes(response.status)) {
|
||||
if ([API_STATUS_CODE.UNAUTHORIZED, API_STATUS_CODE.FORBIDDEN].includes(response?.status)) {
|
||||
// Reset user info
|
||||
dispatch(handleLogout());
|
||||
}
|
||||
|
||||
// Blocking cosmos after operative hours
|
||||
if (API_STATUS_CODE.GONE === response.status && !GLOBAL.IS_IMPERSONATED) {
|
||||
if (API_STATUS_CODE.GONE === response?.status && !GLOBAL.IS_IMPERSONATED) {
|
||||
if (store?.getState().user.withinOperativeHours) {
|
||||
dispatch(setWithinOperativeHours(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
config.retry -= 1;
|
||||
|
||||
Reference in New Issue
Block a user