@hzab/data-model 2.0.0-alpha.0 → 2.0.0-alpha.1

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,6 +1,7 @@
1
- # @hzab/data-model@1.9.0
1
+ # @hzab/data-model@2.0.0
2
2
 
3
3
  break: axios 默认导出实例化后的 axios 实例,axios 源对象通过 axiosDef 导出
4
+ refactor: js 文件改为 js 文件
4
5
 
5
6
  # @hzab/data-model@1.8.8
6
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/data-model",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "data model",
5
5
  "main": "src",
6
6
  "scripts": {
package/src/data-model.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import { axios, axiosDef } from "./axios";
2
+ import { axios, isCancel } from "./axios";
3
3
  import {
4
4
  objToFormData,
5
5
  formDataToObj,
@@ -406,7 +406,7 @@ class DataModel<T = any> {
406
406
  const params = _.merge({}, record, ctx);
407
407
  _.each(params, (value, key) => {
408
408
  if (!_.isString(value) || !_.isNumber(value) || _.isBoolean(value)) {
409
- apiUrl = apiUrl.replace(new RegExp(`:${key}$|:${key}(?=\/)`), value);
409
+ apiUrl = apiUrl.replace(new RegExp(`:${key}$|:${key}(?=/)`), value);
410
410
  }
411
411
  });
412
412
  return apiUrl;
@@ -704,8 +704,8 @@ class DataModel<T = any> {
704
704
  * @param reject 失败回调
705
705
  */
706
706
  handleRes(response: any, resolve: (res: any) => void, reject: (err: ApiError) => void) {
707
- if (axiosDef.isCancel(response)) {
708
- console.info("errorHandler axiosDef.isCancel", response);
707
+ if (isCancel(response)) {
708
+ console.info("errorHandler isCancel", response);
709
709
  return;
710
710
  }
711
711
  if (this.isResponse) {
@@ -755,8 +755,8 @@ class DataModel<T = any> {
755
755
  * @param reject Promise reject 回调
756
756
  */
757
757
  errorHandler(err: any = {}, reject: (err: ApiError) => void) {
758
- if (axiosDef.isCancel(err)) {
759
- console.info("errorHandler axiosDef.isCancel", err);
758
+ if (isCancel(err)) {
759
+ console.info("errorHandler isCancel", err);
760
760
  return;
761
761
  }
762
762
  if (this.isResponse) {