@hzab/data-model 0.0.1 → 0.0.3
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/package.json +1 -1
- package/src/axios.js +10 -4
- package/src/data-model.js +1 -1
- package/src/index.js +1 -0
package/package.json
CHANGED
package/src/axios.js
CHANGED
|
@@ -10,16 +10,18 @@ export function setAxios(axiosList) {
|
|
|
10
10
|
/**
|
|
11
11
|
* axios 守卫
|
|
12
12
|
* @param {Function} cb
|
|
13
|
+
* @param {Function} errCb
|
|
13
14
|
*/
|
|
14
|
-
export function setAxRequest(cb) {
|
|
15
|
+
export function setAxRequest(cb, errCb) {
|
|
15
16
|
temp.axiosList?.forEach((_ax) => {
|
|
16
|
-
_ax.interceptors.request.use(cb);
|
|
17
|
+
_ax.interceptors.request.use(cb, errCb);
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* 请求到结果的拦截处理
|
|
22
23
|
* @param {Function} cb
|
|
24
|
+
* @param {Function} errCb
|
|
23
25
|
*/
|
|
24
26
|
export function setAxResponse(cb, errCb) {
|
|
25
27
|
temp.axiosList?.forEach((_ax) => {
|
|
@@ -68,8 +70,12 @@ export function setAxTimeout(timeout = 5000) {
|
|
|
68
70
|
* 设置 token
|
|
69
71
|
* @param {string} token
|
|
70
72
|
*/
|
|
71
|
-
export function
|
|
72
|
-
|
|
73
|
+
export function setAxAuthorization(token) {
|
|
74
|
+
setAxHeaders("Authorization", token);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function setAxBaseUrl(url) {
|
|
78
|
+
setAxDefaults("baseURL", url);
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
export default axios;
|
package/src/data-model.js
CHANGED
|
@@ -144,7 +144,7 @@ class DataModel {
|
|
|
144
144
|
res.list = res.list.map((record) => this.getListMap(record));
|
|
145
145
|
}
|
|
146
146
|
if (this.getListResMap) {
|
|
147
|
-
res
|
|
147
|
+
res = this.getListResMap(res);
|
|
148
148
|
}
|
|
149
149
|
resolve(res);
|
|
150
150
|
},
|