axios cancel api call code example
Example: axios abort request
const cancelTokenSource = axios.CancelToken.source();
axios.get('/user/12345', {
cancelToken: cancelTokenSource.token
});
// Cancel request
cancelTokenSource.cancel();
const cancelTokenSource = axios.CancelToken.source();
axios.get('/user/12345', {
cancelToken: cancelTokenSource.token
});
// Cancel request
cancelTokenSource.cancel();