Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ali322/axios-offline-adapter

offline adapter for axios
https://github.com/ali322/axios-offline-adapter

axios axios-adapter

Last synced: 17 days ago
JSON representation

offline adapter for axios

Awesome Lists containing this project

README

        

axios-offline-adapter
===

cache response each time, responed with cached when request in offline environment

## Install

```bash
npm i axios-offline-adapter --save
```

## Usage

add adapter in your request code

```javascript
import axios from 'axios'
import offlineAdapter from 'axios-offline-adapter'

const offline = offlineAdapter({
name: 'axios-offline',
adapter: axios.defaults.adapter
})

const http = axios.create({
adapter: offline
})

http.get('/path/to/api').then(ret => {
// bussiness code
})
```

## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)