1.1.0 • Published 7 years ago

redux-page v1.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

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() {/* */}
    }
1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago