Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Retry while user is offline #2

Closed
thibautguedou3 opened this issue Dec 6, 2018 · 1 comment
Closed

Retry while user is offline #2

thibautguedou3 opened this issue Dec 6, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@thibautguedou3
Copy link

I am trying to implement a use case when a user performs a request without internet. When I use the retry middleware, the retry is not called if the user isOffline. How would you implement it?

@elbywan elbywan added the enhancement New feature or request label Dec 8, 2018
@elbywan
Copy link
Owner

elbywan commented Dec 8, 2018

Hey @thibautguedou3,

I just published a new version (0.1.8) of the package that now contains the feature, thanks for the suggestion 👍!

Basically, there is a new retryOnNetworkError boolean option.

If you set it to true, when fetch throws because of a network error:

  1. With the default options the request will be retried
  2. You will have access to an extra error argument in the until and onRetry methods

Hope this will suit your needs!

@elbywan elbywan closed this as completed Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants