@lambo-design/shared 1.0.0-beta.310 → 1.0.0-beta.311

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.310",
3
+ "version": "1.0.0-beta.311",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -63,8 +63,10 @@ function requestInterceptors(config) {
63
63
  }
64
64
 
65
65
  // 添加防止重复提交
66
- if(process.env.IF_OPEN_NO_REPEAT_SUBMIT && process.env.IF_OPEN_NO_REPEAT_SUBMIT === "true"){
67
- throttle(config);
66
+ if(process.env.VUE_APP_IF_OPEN_NO_REPEAT_SUBMIT && process.env.VUE_APP_IF_OPEN_NO_REPEAT_SUBMIT === "true"){
67
+ if(throttle(config)){
68
+ return Promise.reject(new Error('数据正在处理,请勿重复提交'));
69
+ }
68
70
  // if(!config.ignoreCancelToken){
69
71
  // abortController.addPending(config);
70
72
  // }
@@ -10,6 +10,7 @@ const getPendingUrl = (config) => {
10
10
  * 防抖(debounce)和节流(throttle)
11
11
  */
12
12
  export function throttle(config) {
13
+ let forbidden = false;
13
14
  if (config) {
14
15
  // 是否需要防止数据重复提交
15
16
  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false ;
@@ -36,11 +37,12 @@ export function throttle(config) {
36
37
  && requestObj.time - lastTime < interval) {
37
38
  const message = '数据正在处理,请勿重复提交';
38
39
  console.warn(`[${lastUrl}]: ` + message);
39
- return Promise.reject(new Error(message));
40
+ forbidden = true;
40
41
  } else {
41
42
  requestObjMap[requestId] = requestObj;
42
43
  }
43
44
  }
44
45
  }
45
46
  }
47
+ return forbidden
46
48
  }