Abort Property
Learn how to make request cancellation functionality cleaner and concise using the abort property.
We'll cover the following...
We'll cover the following...
How to use the abort property
In this example, we have to modify the main api function in the api/api.js. Inside it, we’ll create a new function called withAbort and then use it to wrap all API methods that are returned from the api function.
The withAbort function
The withAbort function does a similar thing as abortable. It injects the cancelToken into the config object. The main difference lies in how we get access to the abort method. At this point, we know for sure that a config object exists due to default parameters specified when the ...