@qlibs/utils 1.14.2 → 1.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/axios.d.ts +1 -0
- package/dist/utils/axios.js +6 -0
- package/package.json +1 -1
package/dist/utils/axios.d.ts
CHANGED
package/dist/utils/axios.js
CHANGED
|
@@ -4,6 +4,10 @@ exports.injectAxiosInstance = injectAxiosInstance;
|
|
|
4
4
|
const auth_1 = require("./auth");
|
|
5
5
|
const browser_1 = require("./browser");
|
|
6
6
|
function injectAxiosInstance(axiosInstance, headers, Modal) {
|
|
7
|
+
let timezone = headers['X-Timezone'];
|
|
8
|
+
if (!timezone) {
|
|
9
|
+
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
10
|
+
}
|
|
7
11
|
axiosInstance.interceptors.request.use(async (config) => {
|
|
8
12
|
if (typeof headers === 'object') {
|
|
9
13
|
config.headers['Content-Type'] =
|
|
@@ -12,6 +16,7 @@ function injectAxiosInstance(axiosInstance, headers, Modal) {
|
|
|
12
16
|
config.headers['X-Device-Id'] = headers['X-Device-Id'];
|
|
13
17
|
config.headers['X-Device-Name'] = headers['X-Device-Name'];
|
|
14
18
|
config.headers['X-App-Version'] = headers['X-App-Version'];
|
|
19
|
+
config.headers['X-Timezone'] = timezone;
|
|
15
20
|
}
|
|
16
21
|
else {
|
|
17
22
|
config.headers['Content-Type'] =
|
|
@@ -20,6 +25,7 @@ function injectAxiosInstance(axiosInstance, headers, Modal) {
|
|
|
20
25
|
config.headers['X-Device-Id'] = (0, browser_1.getBrowserId)();
|
|
21
26
|
config.headers['X-Device-Name'] = (0, browser_1.getBrowserName)();
|
|
22
27
|
config.headers['X-App-Version'] = '0.0.0';
|
|
28
|
+
config.headers['X-Timezone'] = timezone;
|
|
23
29
|
}
|
|
24
30
|
config.headers['Authorization'] = 'Bearer ' + (0, auth_1.getToken)();
|
|
25
31
|
return config;
|