-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Feature: ctx.http需要暴露interceptors或者提供拦截器功能 #1266
Comments
之后可能会迁移到 fetch API,迁移之后再做考虑(我也不知道 fetch 有没有 interceptor 对应的实现) ref: #1181 |
In paticular your case, I think you could just try {
const res = ctx.http.get(url)
// ...
} catch (e) {
if (Quester.isAxiosError(e) {
if (e.statusCode === 401) {
// re-login and re-request
}
}
} Well, there're no RAII or something in JS, the code might be ugly but usable for now. |
我倾向于在目前的实现上直接提供一套api来做。因为其实并不需要使用axios的interceptor,只需要我们wrap一些东西 |
目前我也是这样实现的,但这开发起来很不友好 |
请问能提供一些使用 axios interceptor 的示例代码吗?我有意实现相关的功能,不过想深入了解你的需求。 |
我尝试在github上搜索了一些刷新token的例子: |
Describe the problem related to the feature request
检查到特定返回值自动重新登陆,
Describe the solution you'd like
ctx.http需要暴露interceptors或者提供拦截器功能
Describe alternatives you've considered
创建新的http
Additional context
No response
The text was updated successfully, but these errors were encountered: