1.0.5 • Published 6 years ago

axios-observable-request v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
6 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

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago