interface IAxiosRetryConfig {
    onMaxRetryTimesExceeded?: ((error, retryCount) => void | Promise<void>);
    onRetry?: ((retryCount, error, requestConfig) => void | Promise<void>);
    retries?: number;
    retryCondition?: ((error) => boolean | Promise<boolean>);
    retryDelay?: ((retryCount, error) => number);
    shouldResetTimeout?: boolean;
}

Hierarchy (view full)

Properties

onMaxRetryTimesExceeded?: ((error, retryCount) => void | Promise<void>)

After all the retries are failed, this callback will be called with the last error before throwing the error.

Type declaration

    • (error, retryCount): void | Promise<void>
    • Parameters

      • error: AxiosError
      • retryCount: number

      Returns void | Promise<void>

onRetry?: ((retryCount, error, requestConfig) => void | Promise<void>)

A callback to get notified when a retry occurs, the number of times it has occurred, and the error

Type declaration

    • (retryCount, error, requestConfig): void | Promise<void>
    • Parameters

      Returns void | Promise<void>

retries?: number

The number of times to retry before failing default: 3

retryCondition?: ((error) => boolean | Promise<boolean>)

A callback to further control if a request should be retried. default: it retries if it is a network error or a 5xx error on an idempotent request (GET, HEAD, OPTIONS, PUT or DELETE).

Type declaration

    • (error): boolean | Promise<boolean>
    • Parameters

      • error: AxiosError

      Returns boolean | Promise<boolean>

retryDelay?: ((retryCount, error) => number)

A callback to further control the delay between retry requests. By default there is no delay.

Type declaration

    • (retryCount, error): number
    • Parameters

      • retryCount: number
      • error: AxiosError

      Returns number

shouldResetTimeout?: boolean

Defines if the timeout should be reset between retries default: false