@hzab/data-model 2.0.2 → 2.0.3-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,11 @@
1
+ # @hzab/data-model@2.1.0
2
+
3
+ refactor: lodash 改为 lodash-es
4
+ feat: RequestCache 接口缓存工具类
5
+
1
6
  # @hzab/data-model@2.0.2
2
7
 
3
- fix: getList _data.content total == 0 情况处理
8
+ fix: getList \_data.content total == 0 情况处理
4
9
 
5
10
  # @hzab/data-model@2.0.1
6
11
 
package/README.md CHANGED
@@ -127,6 +127,23 @@ function Demo({ orgId }) {
127
127
  }
128
128
  ```
129
129
 
130
+
131
+ #### 重复请求拦截
132
+ ```tsx
133
+ import RequestCache from "@hzab/data-model/RequestCache";
134
+ import { AxiosRequestConfigWithCache, setAxRequest } from "@hzab/data-model";
135
+
136
+ const requestCache = new RequestCache({ options: { cacheTTL: 2000 } });
137
+
138
+ setAxRequest((config: AxiosRequestConfigWithCache) => {
139
+ // 拦截 get 请求
140
+ if (config.method.toLowerCase() === "get") {
141
+ return requestCache.handleAxRequest(config);
142
+ }
143
+ return config;
144
+ });
145
+ ```
146
+
130
147
  ## DataModel
131
148
 
132
149
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/data-model",
3
- "version": "2.0.2",
3
+ "version": "2.0.3-alpha.1",
4
4
  "description": "data model",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -34,6 +34,7 @@
34
34
  "eslint": "^8.30.0",
35
35
  "js-cookie": "^3.0.5",
36
36
  "less": "^4.1.3",
37
+ "lodash-es": "^4.18.1",
37
38
  "mobx": "^6.7.0",
38
39
  "mobx-react": "^7.6.0",
39
40
  "react": "^17.0.2",
@@ -48,8 +49,6 @@
48
49
  },
49
50
  "dependencies": {
50
51
  "dayjs": "^1.11.7",
51
- "axios": ">=1.6.2",
52
- "js-cookie": ">=3.0.5",
53
52
  "nanoid": "^3.3.7"
54
53
  },
55
54
  "directories": {