fix: 修复请求示例中,mock开启时无法取消单个请求的问题

This commit is contained in:
huishanyi 2024-02-01 16:27:03 +08:00
parent 14ff83affc
commit d6d70a443c

View File

@ -18,7 +18,7 @@ axiosInstance.interceptors.request.use((res: InternalAxiosRequestConfig) => {
const controller = new AbortController()
const url = res.url || ''
res.signal = controller.signal
abortControllerMap.set(url, controller)
abortControllerMap.set(import.meta.env.VITE_USE_MOCK ? url.replace('/mock', '') : url, controller)
return res
})