Skip to content

Commit

Permalink
fix: runWhen should be nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
yutak23 committed Dec 18, 2023
1 parent 7e7c61e commit e06b2db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface AxiosResponseInterceptorManagerExtended extends AxiosInterceptorManage
fulfilled: ((value: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>) | null;
rejected: ((error: any) => any) | null;
synchronous: boolean;
runWhen: (config: InternalAxiosRequestConfig) => boolean;
runWhen: (config: InternalAxiosRequestConfig) => boolean | null;
}>;
}

Expand Down Expand Up @@ -253,10 +253,10 @@ const axiosRetry: AxiosRetry = (axiosInstance, defaultOptions) => {
return new Promise((resolve) => {
setTimeout(() => {
if (currentState.disableOtherResponseInterceptors && currentState.retryCount === 1) {
const extendedInterceptor = axiosInstance.interceptors
const responseInterceptors = axiosInstance.interceptors
.response as AxiosResponseInterceptorManagerExtended;
const axiosRetryInterceptor = extendedInterceptor.handlers[responseInterceptorId];
extendedInterceptor.handlers = [axiosRetryInterceptor];
const axiosRetryInterceptor = responseInterceptors.handlers[responseInterceptorId];
responseInterceptors.handlers = [axiosRetryInterceptor];
resolve(axiosInstance(config));
return;
}
Expand Down

0 comments on commit e06b2db

Please sign in to comment.