@qlibs/utils 1.7.3 → 1.7.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 +7 -1
- package/dist/utils/axios.js +6 -2
- package/package.json +1 -1
package/dist/utils/axios.d.ts
CHANGED
@@ -1,2 +1,8 @@
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
2
|
-
export declare function injectAxiosInstance(axiosInstance: AxiosInstance,
|
2
|
+
export declare function injectAxiosInstance(axiosInstance: AxiosInstance, headers: 'application/json' | 'multipart/form-data' | string | {
|
3
|
+
contentType: 'application/json' | 'multipart/form-data' | string;
|
4
|
+
'x-platform'?: 'cms' | 'web' | 'mobile';
|
5
|
+
'x-device-id': string;
|
6
|
+
'x-device-name': string;
|
7
|
+
'x-app-version': string;
|
8
|
+
}, Modal: any): AxiosInstance;
|
package/dist/utils/axios.js
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.injectAxiosInstance = injectAxiosInstance;
|
4
4
|
const auth_1 = require("./auth");
|
5
|
-
function injectAxiosInstance(axiosInstance,
|
5
|
+
function injectAxiosInstance(axiosInstance, headers, Modal) {
|
6
6
|
axiosInstance.interceptors.request.use(async (config) => {
|
7
|
-
config.headers['Content-Type'] = contentType || 'application/json';
|
7
|
+
config.headers['Content-Type'] = (typeof headers === 'object' ? headers.contentType : headers) || 'application/json';
|
8
|
+
config.headers['x-platform'] = headers['x-platform'] || 'cms';
|
9
|
+
config.headers['x-device-id'] = headers['x-device-id'];
|
10
|
+
config.headers['x-device-name'] = headers['x-device-name'];
|
11
|
+
config.headers['x-app-version'] = headers['x-app-version'];
|
8
12
|
config.headers['Authorization'] = 'Bearer ' + (0, auth_1.getToken)();
|
9
13
|
return config;
|
10
14
|
}, (error) => {
|