1.0.5 • Published 7 years ago

axios-observable-request v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

AxiosObservableRequest

npm GitHub last commit PRs Welcome

Installation

yarn add axios-observable-request

or

npm install axios-observable-request

Features

  • Allow Axios to be used in RxJs.
  • Auto-Cancel Axios requests when the Observer is canceled (switchMap, unsubscribe).

Usage

Usage of AxiosObservableRequest with the default Axios config:

import createObservable from "axios-observable-request";

createObservable({
  method: "get",
  url: "https://google.com"
});

Usage of AxiosObservableRequest with a custom Axios config:

import axios from "axios";
import { createObservableInstance } from "axios-observable-request";

const customAxiosInstance = axios.create({
  timeout: 1000,
  headers: { "X-Custom-Header": "foobar" }
});

const customCreateObservable = createObservableInstance(customAxiosInstance);

customCreateObservable({
  method: "get",
  url: "https://google.com"
});

Examples

You can see examples here.

Demo

You can test the demo with react here.

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago