TP-84996 | Caching in RN (#13461)

This commit is contained in:
Prajjaval Verma
2024-11-07 15:31:54 +05:30
committed by GitHub
parent 4d8bb91bbe
commit bd287d20f5
12 changed files with 247 additions and 144 deletions

View File

@@ -1,4 +1,9 @@
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
import {
AnalyticsEventNameConstants,
NETWORK_ERROR,
} from "../App/common/constants";
import { sendAsAnalyticsEvent } from "../App/common/hooks/useAnalyticsEvent";
import { NetworkConnectorModule } from "../App/common/native-module/NativeModules";
import { BASE_URL } from "./NetworkConstant";
@@ -7,7 +12,12 @@ export const getDefaultHeaderData = async () => {
const data = await NetworkConnectorModule.getAllNativeHeaders();
return data;
} catch (error) {
console.error("Error fetching data:", error);
sendAsAnalyticsEvent({
name: AnalyticsEventNameConstants.HI_RN_FETCH_NATIVE_HEADER_ERROR,
properties: {
reason: error?.toString() || NETWORK_ERROR,
},
});
return null;
}
};