22 lines
732 B
TypeScript
22 lines
732 B
TypeScript
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");
|
|
};
|
|
|
|
const getDeviceId = async () => {
|
|
return await getStringPreference("DEVICE_ID", "string");
|
|
};
|
|
|
|
const addBundleVersionToHeader = (axiosInstance: AxiosInstance) => {
|
|
axiosInstance.interceptors.request.use(requestConfig => {
|
|
requestConfig.headers[BUNDLE_VERSION] = (packageJson as any).versionCode;
|
|
return requestConfig;
|
|
});
|
|
};
|
|
|
|
export { getSessionToken, getDeviceId, addBundleVersionToHeader };
|