ba-react-fetch-list-api

0.2.9 • Public • Published

Fetch list data from BluAvenu API

Usage example

Add reducer:

  const
    store = createStore(combineReducers({
      fetchApi: fetchListApiReducers([
        {baseURL: settings.API_URL, entity: 'contacts', key: 'contacts'}
      ]),
    ));

Now apply HOC. In your component you will get [flatFetched.contacts] with fetched data and some meta properties:

import FetchListAPI from 'ba-react-fetch-list-api';

compose(
  FetchListAPI({
    baseURL: settings.API_URL,
    entity : 'contacts',

    // These are GET-request params
    fetchParams: props => {search: props.searchValue},

    filters: 'filter.savedFilters',
    key    : 'contacts',
    page   : `incrementalList.${UNIQUE_ID}.page`,
    sorting: `table.${UNIQUE_ID}.sorting`,
  }),
)

Readme

Keywords

none

Package Sidebar

Install

npm i ba-react-fetch-list-api

Weekly Downloads

4

Version

0.2.9

License

ISC

Last publish

Collaborators

  • nide