0.1.1 • Published 6 years ago

fluture-axios v0.1.1

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

fluture-axios

The axios you love, but better because it now returns a fluture.

Installing

Using npm:

$ npm install fluture-axios axios fluture

Note that fluture-axios depends on axios and fluture as peer dependencies.

Example

Performing a GET request

// Create a future request for a user with a given ID

const userFuture = fluaxios.get('/user?ID=12345')
    
const cancel = userFuture.fork(console.error, console.log)

Note that cancel can be invoked to cancel the request in flight as an abstraction over axios's cancellation.

API

Fluture-axios current supports the following methods from axios:

The above methods will return a future for the request and once forked, will return a cancellation function.

  • See fluture to understand how to work with futures.
  • See axios for more information about working with axios.