smart-fetch-localstorage
v1.0.1
Published
create smart caching fetch data
Downloads
2
Readme
smart-fetch-localstorage
create smart caching fetch data
Installation
$ npm i smart-fetch-localstorage -P
Usage
import smartFetch from 'smart-fetch-localstorage';
await function getData() {
const data = await smartFetch({
url: '/claster_layers/' + object_id,
options: {
method: 'post',
headers,
body: `table=${ table_name }`,
}
})
console.log('data >>', data)
}
getData()
API
smart-fetch-localstorage(parametr)
Parameters
- Object
parametr
: An object containing the following fields:url
(String): query urloptions
(Object): parameter FetchcacheTime
(number): live time fo cache. Default: '86400'
Return
- Promise: cached or queried data
License
MIT © Serhiy Popaduk