Skip to content

Commit

Permalink
Merge pull request #414 from ShanYi-Hui/fix/requestCancelFailure
Browse files Browse the repository at this point in the history
fix: 修复请求示例中,mock开启时无法取消单个请求的问题
  • Loading branch information
kailong321200875 committed Feb 1, 2024
2 parents 14ff83a + b5cb626 commit 4bf5070
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/axios/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 === 'true' ? url.replace('/mock', '') : url, controller)
return res
})

Expand Down

0 comments on commit 4bf5070

Please sign in to comment.