Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能]: @sa/axios: 使用AbortController替换AbortController #532

Closed
honghuangdc opened this issue Jul 8, 2024 · 2 comments
Closed

Comments

@honghuangdc
Copy link
Member

描述

在axios v0.22.0起,CancelToken已被废弃,现在使用AbortController进行替换

建议的解决方案

使用AbortController进行替换

替代方案

No response

额外的上下文

基于CancelToken实现的取消请求是通过给每个请求生成唯一的请求id,供全局去调用,但是无法支持单个请求去控制,现使用AbortController需支持

@NHZEX
Copy link
Contributor

NHZEX commented Jul 8, 2024

是打算放弃cancelRequestcancelAllRequest 方法,还是放弃使用requestId去取消的实现?

cancelAllRequest有场景,当前会话失效后跳转登录页面时,可以取消当前所有请求(因为可能同时存在多个请求在并发,任一请求获得会话完全无效的响应即可安全取消全部请求)。

@honghuangdc
Copy link
Member Author

这两个方法仍然会保留

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants