axios-multi-api icon indicating copy to clipboard operation
axios-multi-api copied to clipboard

[Feature] Add rejectOnTimeout & onLoadingSlow

Open MattCCC opened this issue 1 year ago • 0 comments

The idea is to add two options into the plugin

The onLoadingSlow (null by default) feature is a user-friendly addition that helps monitor slow network conditions or when the server is taking longer than expected to respond. This callback function triggers when a request takes longer than a specified threshold (typically shorter than the timeout limit) but hasn't yet timed out. This provides an opportunity to show a loading indicator, display a message, or offer a cancel option to the user.

The rejectOnTimeout (true by default although that requires some more thought) feature ensures that any request exceeding the specified timeout duration is forcefully rejected. When enabled, this option automatically cancels the request and throws an error if the timeout limit is reached. This behavior is particularly useful for preventing indefinitely hanging requests, ensuring that your application doesn’t wait forever for a response from the server.

MattCCC avatar Oct 01 '24 18:10 MattCCC