fix: prevent admin bootstrap merge helper race
This commit is contained in:
@@ -7,8 +7,7 @@ import { formatRequestDate, joinTimestamp } from './helper';
|
|||||||
import { ContentTypeEnum, RequestEnum, ResultEnum } from '@/enums/httpEnum';
|
import { ContentTypeEnum, RequestEnum, ResultEnum } from '@/enums/httpEnum';
|
||||||
import { PageEnum } from '@/enums/pageEnum';
|
import { PageEnum } from '@/enums/pageEnum';
|
||||||
import { useGlobSetting } from '@/hooks/setting';
|
import { useGlobSetting } from '@/hooks/setting';
|
||||||
import { isString, isUrl } from '@/utils/is/';
|
import { isObject, isString, isUrl } from '@/utils/is/';
|
||||||
import { deepMerge } from '@/utils';
|
|
||||||
import { setObjToUrlParams } from '@/utils/urlUtils';
|
import { setObjToUrlParams } from '@/utils/urlUtils';
|
||||||
import { CreateAxiosOptions, RequestOptions, Result } from './types';
|
import { CreateAxiosOptions, RequestOptions, Result } from './types';
|
||||||
import { useUserStoreWidthOut } from '@/store/modules/user';
|
import { useUserStoreWidthOut } from '@/store/modules/user';
|
||||||
@@ -21,6 +20,14 @@ import { useI18nStore } from '@/store/modules/i18n';
|
|||||||
const globSetting = useGlobSetting();
|
const globSetting = useGlobSetting();
|
||||||
const urlPrefix = globSetting.urlPrefix || '';
|
const urlPrefix = globSetting.urlPrefix || '';
|
||||||
|
|
||||||
|
function mergeOptions<T = any>(src: any = {}, target: any = {}): T {
|
||||||
|
let key: string;
|
||||||
|
for (key in target) {
|
||||||
|
src[key] = isObject(src[key]) ? mergeOptions(src[key], target[key]) : (src[key] = target[key]);
|
||||||
|
}
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 数据处理,方便区分多种处理方式
|
* @description: 数据处理,方便区分多种处理方式
|
||||||
*/
|
*/
|
||||||
@@ -238,7 +245,7 @@ const transform: AxiosTransform = {
|
|||||||
|
|
||||||
function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
||||||
return new VAxios(
|
return new VAxios(
|
||||||
deepMerge(
|
mergeOptions(
|
||||||
{
|
{
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
authenticationScheme: '',
|
authenticationScheme: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user