ba-react-fetch-list-api
v0.2.9
Published
Core module, combining all other modules into single infrastructure
Downloads
3
Readme
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`,
}),
)