From 61d4efd55a8b4f09990b5f1888e23ead43958164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Sat, 26 Jun 2021 12:14:06 +0800 Subject: [PATCH] revert(axios): remove baseUrl config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 无需 baseUrl 配置,已有apiUrl 替代 --- src/utils/http/axios/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index 4285148f..ac52c33e 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -80,7 +80,6 @@ const transform: AxiosTransform = { // 请求之前处理config beforeRequestHook: (config, options) => { - const { baseURL } = config; const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options; if (joinPrefix) { @@ -90,9 +89,6 @@ const transform: AxiosTransform = { if (apiUrl && isString(apiUrl)) { config.url = `${apiUrl}${config.url}`; } - if (baseURL && isString(baseURL)) { - config.url = `${baseURL}${config.url}`; - } const params = config.params || {}; if (config.method?.toUpperCase() === RequestEnum.GET) { if (!isString(params)) { @@ -190,7 +186,7 @@ function createAxios(opt?: Partial) { authenticationScheme: '', timeout: 10 * 1000, // 基础接口地址 - baseURL: globSetting.apiUrl, + // baseURL: globSetting.apiUrl, // 接口可能会有通用的地址部分,可以统一抽取出来 urlPrefix: urlPrefix, headers: { 'Content-Type': ContentTypeEnum.JSON }, -- GitLab