TP-64336 | bundle version added (#10857)

This commit is contained in:
Mayank Singh
2024-05-15 17:47:45 +05:30
committed by GitHub
parent 93f020fca9
commit 42bda72347
4 changed files with 60 additions and 31 deletions

View File

@@ -1,4 +1,7 @@
import { getStringPreference } from "../App/common/utilities/SharedPreferenceUtils";
import packageJson from "../package.json";
import { BUNDLE_VERSION } from "./NetworkConstant";
import { AxiosInstance } from "axios";
const getSessionToken = async () => {
return await getStringPreference("SESSION_TOKEN", "string");
@@ -8,4 +11,11 @@ const getDeviceId = async () => {
return await getStringPreference("DEVICE_ID", "string");
};
export { getSessionToken, getDeviceId };
const addBundleVersionToHeader = (axiosInstance: AxiosInstance) => {
axiosInstance.interceptors.request.use(requestConfig => {
requestConfig.headers[BUNDLE_VERSION] = (packageJson as any).versionCode;
return requestConfig;
});
};
export { getSessionToken, getDeviceId, addBundleVersionToHeader };