Browse Source

处理列表查询出现重复提交问题

kwenhao 2 years ago
parent
commit
2647ccea81
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/utils/request.js

+ 3 - 1
src/utils/request.js

@@ -27,6 +27,8 @@ service.interceptors.request.use(
     const isToken = (config.headers || {}).isToken === false;
     // 是否需要防止数据重复提交
     const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
+    // 是否存在列表查询
+    const isQueryList = config.url.includes("/list");
     if (getToken() && !isToken) {
       config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
     }
@@ -38,7 +40,7 @@ service.interceptors.request.use(
       config.url = url;
     }
     if (
-      !isRepeatSubmit &&
+      !isRepeatSubmit && !isQueryList &&
       (config.method === "post" || config.method === "put")
     ) {
       const requestObj = {