@aucsys/redux-ez

Ez reducers for your basic CRUD needs

Usage no npm install needed!

<script type="module">
  import aucsysReduxEz from 'https://cdn.skypack.dev/@aucsys/redux-ez';
</script>

README

redux-ez

Ez reducers for your basic CRUD needs

NPM JavaScript Style Guide

Install

npm install --save redux-ez

Usage

  1. Create instance of ReduxEz
    const ez = ReduxEz({
        baseUrl: "https://example.com/api",
        makeHeaders: async () => {return {'x-header': 'value'}}
    })
    
  2. Use exposed methods to create slice actions with desired functionality
     const {
         initialState: testInitialState,
         thunk: getTest,
         reducers: testReducers,
         stateNames: getTestStateNames
     } = getSliceActions({
          actionName: "getTest",
          storeName: TEST_STORE_NAME,
          entityNameInStore: "test",
          thunkName: "/test/get",
          showToastOnSuccess: true,
          showToastOnFail: true,
          makePath: (payload) => { // Action payload
              return `/test/${payload.id}`
          }
     })
    
    

License

MIT © aucsys-com