1.0.1 • Published 6 years ago

smart-fetch-localstorage v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

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 url
    • options (Object): parameter Fetch
    • cacheTime (number): live time fo cache. Default: '86400'

Return

  • Promise: cached or queried data

License

MIT © Serhiy Popaduk