This commit is contained in:
qsh
2025-03-21 11:37:25 +08:00
parent 5097cf38f6
commit b155d3ce9e
7 changed files with 301 additions and 226 deletions

View File

@@ -5,7 +5,7 @@ import { config } from './config'
const { default_headers } = config
const request = (option: any) => {
const { url, method, params, data, headersType, responseType, isSubmitForm } = option
const { url, method, params, data, headersType, responseType, isSubmitForm, headers } = option
return service({
url: url,
method,
@@ -14,7 +14,8 @@ const request = (option: any) => {
data,
responseType: responseType,
headers: {
'Content-Type': headersType || default_headers
'Content-Type': headersType || default_headers,
...headers
}
})
}

View File

@@ -66,7 +66,8 @@ service.interceptors.request.use(
// 设置实例
const appId = getAppId()
if (appId) (config as Recordable).headers['instance-id'] = appId
if (appId && !(config as Recordable).headers['instance-id'])
(config as Recordable).headers['instance-id'] = appId
const params = config.params || {}
const data = config.data || false