Xiao_123 1 vuosi sitten
vanhempi
commit
445567ac65
2 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 1 1
      package.json
  2. 3 1
      src/config/axios/service.js

+ 1 - 1
package.json

@@ -3,7 +3,7 @@
   "version": "0.0.0",
   "scripts": {
     "dev": "vite --host 0.0.0.0",
-    "build:dev": "vite build --mode dev",
+    "build:dev": "vite build --mode development",
     "build": "vite build",
     "preview": "vite preview",
     "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",

+ 3 - 1
src/config/axios/service.js

@@ -54,10 +54,12 @@ service.interceptors.request.use(
       ;(config).headers.Authorization = 'Bearer ' + getToken() // 让每个请求携带自定义token
     }
     // 设置租户
+    console.log('tenantEnable', import.meta.env.VITE_TENANTCODE)
     if (tenantEnable && tenantEnable === 'true') {
       const tenantId = import.meta.env.VITE_TENANTCODE
-      if (tenantId) (config).headers['tenant-id'] = tenantId
+      if (tenantId) config.headers['tenant-id'] = tenantId
     }
+    console.log(config)
     const params = config.params || {}
     const data = config.data || false
     if (