Browse Source

token 允许为空

zhuth 6 năm trước cách đây
mục cha
commit
14808520ed
3 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 2 0
      src/models/chartDesigner.js
  2. 2 0
      src/models/dashboardDesigner.js
  3. 2 1
      src/services/index.js

+ 2 - 0
src/models/chartDesigner.js

@@ -1087,6 +1087,8 @@ export default {
         
                         let res = yield call(service.fetch, {
                             url: inDashboard ? URLS.CHART_OPTION : URLS.CHART_DATAVIEW_OPTION,
+                            token: inDashboard ? false : true,
+                            allow: true,
                             body: body,
                             timeout: 30000
                         });

+ 2 - 0
src/models/dashboardDesigner.js

@@ -631,6 +631,7 @@ export default {
                 };
                 const res = yield call(service.fetch, {
                     url: URLS.CHART_OPTION,
+                    token: false,
                     allow: true,
                     body,
                     timeout: 30000
@@ -782,6 +783,7 @@ export default {
                 };
                 const res = yield call(service.fetch, {
                     url: URLS.CHART_OPTION,
+                    token: false,
                     allow: true,
                     body,
                     timeout: 30000

+ 2 - 1
src/services/index.js

@@ -14,7 +14,7 @@ function debounce(option) {
 }
 export function fetch(option) {
     let { url, method, headers, body, timeout, allow, requestType, fileName } = option;
-    const token = window.sessionStorage.getItem("token");
+    const token = token === false ? null : window.sessionStorage.getItem("token");
     return debounce({ url, method, body }).then(() => {
         // 除非特殊许可,Token不存在时不发送请求
         if(token || allow) {
@@ -26,6 +26,7 @@ export function fetch(option) {
                     token: token,
                     'Content-Type': 'application/json'
                 }, headers);
+
                 if (body) {  
                     let paramsArray = [];  
                     //拼接参数