增加配置判断 (#311)

新增配置项判断,避免出现undefined导致的无效url
This commit is contained in:
Kerwin Bryant 2022-09-16 21:04:48 +08:00 committed by GitHub
parent 4d74a2c66f
commit 7d9e973f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ const transform: AxiosTransform = {
const { apiUrl, isJoinPrefix, urlPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
// 添加接口前缀
if (isJoinPrefix) {
if (isJoinPrefix && urlPrefix && isString(urlPrefix)) {
config.url = `${urlPrefix}${config.url}`;
}