mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-02-02 18:08:40 +08:00
revert(axios): remove baseUrl config
无需 baseUrl 配置,已有apiUrl 替代
This commit is contained in:
parent
d5f9919b60
commit
61d4efd55a
@ -80,7 +80,6 @@ const transform: AxiosTransform = {
|
|||||||
|
|
||||||
// 请求之前处理config
|
// 请求之前处理config
|
||||||
beforeRequestHook: (config, options) => {
|
beforeRequestHook: (config, options) => {
|
||||||
const { baseURL } = config;
|
|
||||||
const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
|
const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
|
||||||
|
|
||||||
if (joinPrefix) {
|
if (joinPrefix) {
|
||||||
@ -90,9 +89,6 @@ const transform: AxiosTransform = {
|
|||||||
if (apiUrl && isString(apiUrl)) {
|
if (apiUrl && isString(apiUrl)) {
|
||||||
config.url = `${apiUrl}${config.url}`;
|
config.url = `${apiUrl}${config.url}`;
|
||||||
}
|
}
|
||||||
if (baseURL && isString(baseURL)) {
|
|
||||||
config.url = `${baseURL}${config.url}`;
|
|
||||||
}
|
|
||||||
const params = config.params || {};
|
const params = config.params || {};
|
||||||
if (config.method?.toUpperCase() === RequestEnum.GET) {
|
if (config.method?.toUpperCase() === RequestEnum.GET) {
|
||||||
if (!isString(params)) {
|
if (!isString(params)) {
|
||||||
@ -190,7 +186,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
|||||||
authenticationScheme: '',
|
authenticationScheme: '',
|
||||||
timeout: 10 * 1000,
|
timeout: 10 * 1000,
|
||||||
// 基础接口地址
|
// 基础接口地址
|
||||||
baseURL: globSetting.apiUrl,
|
// baseURL: globSetting.apiUrl,
|
||||||
// 接口可能会有通用的地址部分,可以统一抽取出来
|
// 接口可能会有通用的地址部分,可以统一抽取出来
|
||||||
urlPrefix: urlPrefix,
|
urlPrefix: urlPrefix,
|
||||||
headers: { 'Content-Type': ContentTypeEnum.JSON },
|
headers: { 'Content-Type': ContentTypeEnum.JSON },
|
||||||
|
Loading…
Reference in New Issue
Block a user