From 6375f532e9459e96f93dc40b56e52d7766d6ebbc Mon Sep 17 00:00:00 2001 From: renqian805 <1743369777@qq.com> Date: Wed, 27 Jul 2022 01:16:54 +0800 Subject: [PATCH] fix: invalid regular expression in safari fix #108 --- src/utils/request.ts | 3 ++- src/utils/urlUtils.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index b9c5474ec..f035decef 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,5 +1,6 @@ import axios from 'axios'; import { message as $message } from 'ant-design-vue'; +import { uniqueSlash } from './urlUtils'; import type { AxiosRequestConfig } from 'axios'; import { ACCESS_TOKEN_KEY } from '@/enums/cacheEnum'; import { Storage } from '@/utils/Storage'; @@ -113,7 +114,7 @@ export const request = async ( return $message.error('你没有访问该接口的权限,请联系管理员!'); } const fullUrl = `${(isMock ? baseMockUrl : baseApiUrl) + config.url}`; - config.url = fullUrl.replace(/(? path.replace(/(? path.replace(/(https?:\/)|(\/)+/g, '$1$2'); +// Safari 不支持以下正则(反向否定查找) shit! +// export const uniqueSlash = (path: string) => path.replace(/(?