Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support callback for retry option #358

Open
1 task done
enkot opened this issue Feb 5, 2024 · 0 comments
Open
1 task done

feat: support callback for retry option #358

enkot opened this issue Feb 5, 2024 · 0 comments

Comments

@enkot
Copy link

enkot commented Feb 5, 2024

Describe the feature

There are situations when we need to retry the request based on the special code returned by the API.
I suggest adding support for a callback for retry option, which is a function that takes a fetch context object and count of retries and returns a boolean (true if the request needs to be retried):

await $fetch('/cart', {
  retry: (ctx, count) => {
    return count <= 3 && ctx.error.code === '007'
  }
})

Additional information

  • Would you be willing to help implement this feature?
@enkot enkot mentioned this issue Feb 5, 2024
8 tasks
@enkot enkot changed the title feat: add retryCb option feat: support callback for retry option Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant