softonic/axios-retry

Change the axios config when retry based on the error

Closed this issue · 0 comments

Hi, in our use case we need to use a different URL if the backend returns a specific error.
I saw some examples where you can use config["axios-retry"].retryCount in a different interceptor to change the config if it's a retried call, but it doesn't provide the previous error so it's not doable in this approach.
There is also the onRetry API which does provide the previous error and the config, but it doesn't have the functionality to change the config for the retried call.
Would there be any other solutions? Or I'll have to create my own fork for this feature?


Just figured out the config reference is passed through the onRetry function, so I can modify it from there and it would be used in the next call.