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

errorHandler 的error中没有request请求的参数? #46

Closed
liuxiawang opened this issue Apr 26, 2019 · 2 comments
Closed

errorHandler 的error中没有request请求的参数? #46

liuxiawang opened this issue Apr 26, 2019 · 2 comments

Comments

@liuxiawang
Copy link

想在token过期时无感知的刷新token并继续执行原有的操作,在errorHandler中捕获到401错误,刷新token成功后,再次调用原先请求,但是没有post请求body里面的参数,请问这个有什么更好解决办法嘛?如果使用response拦截器的话,重新请求了接口还是会再走一遍errorHandler函数,在yield call()中得不到正确的返回结果...

@clock157
Copy link
Contributor

post 的 body 没有带在 response 中,如果本次请求失败,可以在服务端将你需要的额外参数写在返回的 header 中,供你重试时使用。

@clock157
Copy link
Contributor

const { response } = error;
const failedBody = response.headers.get('failedBody');

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

3 participants