sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
MIT License
11.83k stars 341 forks source link

How to abort retry before hitting the retry limit? #550

Closed KyleRicardo closed 6 months ago

KyleRicardo commented 6 months ago

Hi community,

I'm using beforeRetry hook to do the refresh token logic, and if the refreshToken is expired, I'll receive an error, so I should not try another time and navigate the user to the login page. But even if I return the ky.stop, the retry seems not to stop until hit the limit.

What should I do to prevent from keep retrying? Thanks in advance!