TP-64336 | bundle version added (#10857)
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user