b2k-redux-api-middleware

0.0.2 • Public • Published

redux-api-middleware

middleware for handling api requests

Usage

npm install --save b2k-redux-api-middleware

import { getApiReducer, baseState, initial, load, success, fail, reset } from '@baohx2000/redux-api-middleware';
// Only getApiReducer is actually needed.  The rest are just basic helper objects & methods
 
const myReducer = getApiReducer(
  'MYACTION', // base action string,
  baseState, // base state for reducer... note there are many objects included to help compose this base
  initial, // Reducer called upon initial api call
  load, // reducer called immediately after initial call
  success, // called with response from successful call
  fail, // called with response from unsuccessful call (>= 400)
  reset // Call manually to reset the store
);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    1

Package Sidebar

Install

npm i b2k-redux-api-middleware

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • baohx2000