import wretch from 'wretch'import { retry } from 'wretch/middlewares'wretch().middlewares([ retry({ // Options - defaults below delayTimer: 500, delayRamp: (delay, nbOfAttempts) => delay * nbOfAttempts, maxAttempts: 10, until: (response, error) => response && response.ok, onRetry: null, retryOnNetworkError: false, resolveWithLatestReponse: false })])// You can also return a Promise, which is useful if you want to inspect the body:wretch().middlewares([ retry({ until: response => response.clone().json().then(body => body.field === 'something' ) })])
Optional
Generated using TypeDoc
Retry middleware
Retries a request multiple times in case of an error (or until a custom condition is true).