Commit 61d4efd55a8b4f09990b5f1888e23ead43958164

Authored by 无木
1 parent d5f9919b

revert(axios): remove baseUrl config

无需 baseUrl 配置,已有apiUrl 替代
Showing 1 changed file with 1 additions and 5 deletions
src/utils/http/axios/index.ts
@@ -80,7 +80,6 @@ const transform: AxiosTransform = { @@ -80,7 +80,6 @@ const transform: AxiosTransform = {
80 80
81 // 请求之前处理config 81 // 请求之前处理config
82 beforeRequestHook: (config, options) => { 82 beforeRequestHook: (config, options) => {
83 - const { baseURL } = config;  
84 const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options; 83 const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
85 84
86 if (joinPrefix) { 85 if (joinPrefix) {
@@ -90,9 +89,6 @@ const transform: AxiosTransform = { @@ -90,9 +89,6 @@ const transform: AxiosTransform = {
90 if (apiUrl && isString(apiUrl)) { 89 if (apiUrl && isString(apiUrl)) {
91 config.url = `${apiUrl}${config.url}`; 90 config.url = `${apiUrl}${config.url}`;
92 } 91 }
93 - if (baseURL && isString(baseURL)) {  
94 - config.url = `${baseURL}${config.url}`;  
95 - }  
96 const params = config.params || {}; 92 const params = config.params || {};
97 if (config.method?.toUpperCase() === RequestEnum.GET) { 93 if (config.method?.toUpperCase() === RequestEnum.GET) {
98 if (!isString(params)) { 94 if (!isString(params)) {
@@ -190,7 +186,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) { @@ -190,7 +186,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
190 authenticationScheme: '', 186 authenticationScheme: '',
191 timeout: 10 * 1000, 187 timeout: 10 * 1000,
192 // 基础接口地址 188 // 基础接口地址
193 - baseURL: globSetting.apiUrl, 189 + // baseURL: globSetting.apiUrl,
194 // 接口可能会有通用的地址部分,可以统一抽取出来 190 // 接口可能会有通用的地址部分,可以统一抽取出来
195 urlPrefix: urlPrefix, 191 urlPrefix: urlPrefix,
196 headers: { 'Content-Type': ContentTypeEnum.JSON }, 192 headers: { 'Content-Type': ContentTypeEnum.JSON },