NTP-14132| rebase master

This commit is contained in:
aishwarya.srivastava
2024-11-29 15:52:35 +05:30
6 changed files with 28 additions and 5 deletions

View File

@@ -206,6 +206,12 @@ const firebaseSignout = async () => {
export const handleLogout = () => async (dispatch: AppDispatch) => {
try {
CosmosForegroundService.isRunning().then((isRunning) => {
if (isRunning) {
CosmosForegroundService.clearTasks();
CosmosForegroundService.stopAll();
}
});
await firebaseSignout();
await handleGoogleLogout();
await clearAllAsyncStorage();

View File

@@ -36,7 +36,7 @@ export const makeACallToCustomer =
dispatch(setIsCallCreationLoading(true));
dispatch(setConnectingToCustomerBottomSheet(true));
axiosInstance
.post(url, {}, { headers: { donotHandleError: true } })
.post(url, {}, { headers: { donotHandleError: true, autoLogoutOnUnauthorized: true } })
.catch((err: Error) => {
if (details?.isCallHistory) {
dispatch(

View File

@@ -7,6 +7,8 @@ import { setAddresses, setAddressLoading } from '../reducer/addressSlice';
import { MILLISECONDS_IN_A_MINUTE, _map } from '../../RN-UI-LIB/src/utlis/common';
import { logError } from '../components/utlis/errorUtils';
import { type IDocument, removeDocumentByQuestionKey } from '../reducer/feedbackImagesSlice';
import { addClickstreamEvent } from '@services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '@common/Constants';
export const getRepaymentsData = (loanAccountNumber: string) => (dispatch: AppDispatch) => {
dispatch(setRepaymentsLoading({ loanAccountNumber, isLoading: true }));
@@ -141,6 +143,9 @@ export const uploadImages =
dispatch(removeDocumentByQuestionKey({ caseKey, questionKey }));
})
.catch((err) => {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_PERSIST_ORIGINAL_IMAGE_FAILURE, {
payload: formData,
});
logError(err as Error, 'Error uploading image to document service');
});
});

View File

@@ -1371,7 +1371,12 @@ export const CLICKSTREAM_EVENT_NAMES = {
FA_POST_OPERATIVE_HOURS_SCREEN_LOADED: {
name: 'FA_POST_OPERATIVE_HOURS_SCREEN_LOADED',
description: 'Post operative hours screen loaded'
}
},
FA_PERSIST_ORIGINAL_IMAGE_FAILURE: {
name: 'FA_PERSIST_ORIGINAL_IMAGE_FAILURE',
description: 'Failed to persist original image'
},
} as const;
export enum MimeType {

View File

@@ -230,6 +230,8 @@ export const API_STATUS_CODE = {
POST_OPERATIVE_HOURS_ACTIVITY: 451
};
export const UNAUTHORIZED_VALUES = [API_STATUS_CODE.UNAUTHORIZED, API_STATUS_CODE.FORBIDDEN];
const API_TIMEOUT_INTERVAL = 2e4; // 20s
let dispatch: Dispatch<any>;
@@ -349,8 +351,10 @@ axiosInstance.interceptors.response.use(
Number
);
if (
config?.headers?.donotHandleError ||
donotHandleErrorOnStatusCode.includes(error?.response?.status)
(config?.headers?.donotHandleError ||
donotHandleErrorOnStatusCode.includes(error?.response?.status)) &&
// Logout even donotHandleError is true when status code is 401, 403
!config?.headers?.autoLogoutOnUnauthorized
) {
return Promise.reject(error);
}

View File

@@ -28,6 +28,7 @@ export const sendLocationAndActivenessToServerV2 =
.post(getApiUrl(ApiKeys.SEND_LOCATION), geolocationBuffer, {
headers: {
donotHandleError: 'true',
autoLogoutOnUnauthorized: true
},
})
.then(() => {
@@ -84,7 +85,9 @@ export const sendCurrentGeolocationAndBuffer =
export const getSyncTime = async () => {
try {
const url = getApiUrl(ApiKeys.SYNC_TIME);
const response = await axiosInstance.get(url, { headers: { donotHandleError: true } });
const response = await axiosInstance.get(url, {
headers: { donotHandleError: true, autoLogoutOnUnauthorized: true },
});
return response?.data?.currentTimestamp;
} catch (error) {
console.log(error);