Skip to content

Commit

Permalink
fix(request.ts): baseUrl路径替换正则错误
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Dec 10, 2021
1 parent 3818cb2 commit 39c61e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export const request = async <T = any>(
if (permCode && !useUserStore().perms.includes(permCode)) {
return $message.error('你没有访问该接口的权限,请联系管理员!');
}
config.url = `${(isMock ? baseMockUrl : baseApiUrl) + config.url}`.replace(/\/{2,}/g, '/');
const fullUrl = `${(isMock ? baseMockUrl : baseApiUrl) + config.url}`;
config.url = fullUrl.replace(/(?<!:)\/{2,}/g, '/');

const res = await service.request(config);
successMsg && $message.success(successMsg);
errorMsg && $message.error(errorMsg);
Expand Down

0 comments on commit 39c61e3

Please sign in to comment.