unjs / ofetch

😱 A better fetch API. Works on node, browser and workers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to retry a request after an error

CernyMatej opened this issue · comments

Describe the feature

I believe it would be beneficial to have the ability to easily retry a failed request based on custom logic defined in an interceptor. For instance, in the case of a 401 response, you could refresh your session in an interceptor and then, if the refresh is successful, you could retry the original request easily by calling retry().

What do you think?

Additional information

  • Would you be willing to help implement this feature?