Options
All
  • Public
  • Public/Protected
  • All
Menu

@sensenet/redux-promise-middleware

sn-redux-promise-middleware

Greenkeeper badge

Build Status codecov Codacy Badge License Commitizen friendly

sensenet's redux promise middleware enables handling of async actions in Redux based on Redux Promise Middleware. This middleware is a custom implementation of the mentioned one so install, include and use it the same way except that:

  • it needs a repository as an input param, so that sensenet repository and the related API can be used inside Actions,
  • it does not have a customizable config
    • Action suffixes are hardcoded (LOADING, SUCCESS, FAILURE)
    • Action delimiter is hardcoded '_'

Install

npm i redux-promise-middleware -s

Setup

import { Repository } from '@sensenet/client-core'
import promiseMiddleware from '@sensenet/redux-promise-middleware'

const repository = new Repository({ repositoryUrl: 'https://mySensenetSite.com' }, async () => ({ ok: true } as any))

...

const store = createStore(
    rootReducer,
    persistedState,
    applyMiddleware([promiseMiddleware(repository)]),
)

Use

About how to use it with Actions check sn-redux docs.

Generated using TypeDoc