TP-81440 | React Screen Load TIme AIs (#12378)

Co-authored-by: Raaj Gopal <raaj.gopal@navi.com>
This commit is contained in:
Prajjaval Verma
2024-09-09 19:49:54 +05:30
committed by GitHub
parent e3abb087b8
commit 22c0a34f30
3 changed files with 11 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ export const EVENT_PROPERTY_KEYS = {
BUNDLE_VERSION: "bundleVersion",
SCREEN_NAME: "screenName",
LOAD_TIME: "loadTime",
SCREEN_STATE: "screenState",
};
export const EVENT_PROPERTY_VALUES = {

View File

@@ -27,6 +27,7 @@ const useScreenLoadTime = (
properties: {
[EVENT_PROPERTY_KEYS.SCREEN_NAME]: screenName,
[EVENT_PROPERTY_KEYS.LOAD_TIME]: loadTime,
[EVENT_PROPERTY_KEYS.SCREEN_STATE]: ScreenState[screenState],
},
};

View File

@@ -5,6 +5,12 @@ import axios from "axios";
import { getBuildConfigDetails } from "../App/common/utilities/CacheUtils";
import { addBundleVersionToHeader } from "./NetworkUtils";
function newAbortSignal(timeoutMs: number): AbortSignal {
const abortController = new AbortController();
setTimeout(() => abortController.abort(), timeoutMs || 10000);
return abortController.signal;
}
export const get = async <T>(
url: string,
config?: AxiosRequestConfig,
@@ -19,6 +25,7 @@ export const get = async <T>(
baseURL: baseUrl ? baseUrl : BASE_URL,
timeout: 10000,
headers: requestConfig.headers,
signal: newAbortSignal(11000)
});
addBundleVersionToHeader(axiosInstance);
@@ -45,6 +52,7 @@ export const post = async <T>(
baseURL: baseUrl ? baseUrl : BASE_URL,
timeout: 10000,
headers: requestConfig.headers,
signal: newAbortSignal(11000)
});
addBundleVersionToHeader(axiosInstance);
@@ -75,6 +83,7 @@ export const patch = async <T>(
baseURL: baseUrl ? baseUrl : BASE_URL,
timeout: 10000,
headers: requestConfig.headers,
signal: newAbortSignal(11000)
});
addBundleVersionToHeader(axiosInstance);