You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportdefaultfunctioncreateAuthRefreshInterceptor(instance: AxiosInstance,refreshAuthCall: (error: any)=>Promise<any>,options: AxiosAuthRefreshOptions={},): number{if(typeofrefreshAuthCall!=='function'){thrownewError('axios-auth-refresh requires `refreshAuthCall` to be a function that returns a promise.');}// 注册一个 response interceptorreturninstance.interceptors.response.use((response: AxiosResponse)=>response,(error: any)=>{options=mergeOptions(defaultOptions,options);// 判断是否跳过该 interceptorif(!shouldInterceptError(error,options,instance,cache)){returnPromise.reject(error);}//cache.skipInstances.push(instance);// If refresh call does not exist, create one// 调用刷新函数 refreshAuthCall,如果多个请求失败,已经有刷新在执行,则不再调用constrefreshing=createRefreshCall(error,refreshAuthCall,cache);// Create interceptor that will bind all the others requests until refreshAuthCall is resolved// 重发请求之前添加一个 request interceptor,运行自定义的 onRetrycreateRequestQueueInterceptor(instance,cache,options);returnrefreshing.finally(()=>unsetCache(instance,cache)).catch(error=>Promise.reject(error))// 刷新完成后,重新发送原请求.then(()=>resendFailedRequest(error,getRetryInstance(instance,options)));});}
The text was updated successfully, but these errors were encountered: