We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
例如某个页面要请求多个接口,接口均需要token,此时token不存在或过期,这多个请求就会一起去请求token,能否提供一个功能类似是这样,请求前锁定,验证token有效或者无效了拿回真正token后,unlock同时发出的请求继续执行,这样就不会同时去请求token
request.interceptors.request.use((config) => { return new Promise((resolve, reject) => { // console.log("请求拦截器"); request.lock() getAccessToken() .then((data) => { const { tokenType, value } = data config.headers['Authorization'] = tokenType + ' ' + value resolve(config) request.unlock() }) .catch((error) => { request.unlock() reject(error) }) }) })
当然也可以在每个请求resolve之后再执行下一个请求,但不那么优雅
谢谢大佬
The text was updated successfully, but these errors were encountered:
这个事,现在是有解决方案的。就是无痛刷新token. 只不过没有集成到插件里,看后期能不能弄进去吧
Sorry, something went wrong.
No branches or pull requests
例如某个页面要请求多个接口,接口均需要token,此时token不存在或过期,这多个请求就会一起去请求token,能否提供一个功能类似是这样,请求前锁定,验证token有效或者无效了拿回真正token后,unlock同时发出的请求继续执行,这样就不会同时去请求token
当然也可以在每个请求resolve之后再执行下一个请求,但不那么优雅
谢谢大佬
The text was updated successfully, but these errors were encountered: