Using the proposed /api/cancel endpoint, make all API calls cancellable.
see https://github.com/Linkurious/linkurious-server/issues/779
How
Add a cancellable boolean option to all option object of all requests
When options.cancellable is true:
- generate a random
cancellationToken and add it to the request parameters
- add a cancellation handler in the request response promise chain (
.then(onResolve, onFailure, onCancel))
- if the promise is cancelled, use the generated
cancellationToken to cancel the server-side query using the /api/cancel endoint
Using the proposed
/api/cancelendpoint, make all API calls cancellable.see https://github.com/Linkurious/linkurious-server/issues/779
How
Add a
cancellableboolean option to all option object of all requestsWhen
options.cancellableis true:cancellationTokenand add it to the request parameters.then(onResolve, onFailure, onCancel))cancellationTokento cancel the server-side query using the/api/cancel endoint