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