@hzab/data-model 1.7.2 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # @hzab/data-model@1.7.3
2
+
3
+ fix: axios 统一
4
+
1
5
  # @hzab/data-model@1.7.2
2
6
 
3
7
  feat: axios.js getCancelTokenSource 获取 axios.CancelToken.source, 用于取消请求
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/data-model",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "data model",
5
5
  "main": "src",
6
6
  "scripts": {
package/src/axios.js CHANGED
@@ -129,4 +129,6 @@ export function getCancelTokenSource() {
129
129
  return axios.CancelToken.source();
130
130
  }
131
131
 
132
+ export { axios };
133
+
132
134
  export default axios;
package/src/data-model.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import axios from "axios";
2
+ import axios from "./axios";
3
3
 
4
4
  import { objToFormData, formDataToObj, _$Temp, setDefaultAxios, setDefaultErrMsg, setNetworkErrMsg } from "./utils";
5
5
 
@@ -458,6 +458,10 @@ class DataModel {
458
458
  }
459
459
 
460
460
  handleRes(response, resolve, reject) {
461
+ if (axios.isCancel(response)) {
462
+ reject(response);
463
+ return;
464
+ }
461
465
  if (this.isResponse) {
462
466
  resolve(response);
463
467
  return;