Skip to content

Make requests cancellable #21

@davidrapin

Description

@davidrapin

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions