Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

redux-page

tony-kerz9MIT1.1.0

action/reducer combo to assist with paging against a restful data source

readme

redux-page

action/reducer combo to assist with paging against a restful data source

styled with prettier XO code style

usage

  • uses redux-pack, so need to follow directions and add middleware

  • configure an instance with a promise based service that adheres to the following contract

    • input:
      {offset: 1, limit: 1, sort: {field: 'name', isAscending: true}, ...fieldFilters}

      fieldFilters (arbitrary name, just illustrating with spread operator above) are optional, but can contain resource specific filters like {lastName: 'smith'}

    • output:
      {data: [{}], total: 1, query: {/* just returns input argument */}}
  • obtain an instance of redux-page like below

      import config from 'config'
      import getRedux from 'redux-page'
      import {feathers} from 'web-helpr'
      import {openSnackbar} from '../layout/layout-redux'
    
      const url = config.api.url
      const resource = 'people'
      const index = feathers.getIndex({url, resource})
      export default getRedux({resource: 'people', index, limit: 3, onFailure: openSnackbar})
  • redux-page instance will be an object like below which can be used as in typical redux fashion:

      {
        actions: {
          //...
        },
        reducer: function() {/* */}
      }