How to use this together with redux-promise-middleware?
ir-fuel opened this issue · 1 comments
ir-fuel commented
This react/redux stuff is getting pretty complicated I must say, when looking at dependencies to solve different issues ( react-router, redux-router, redux-thunk ...) and making them play together is quite a challenge, so here is another one:
I currently use redux-promise-middleware
to do promise based async actions. For each action this middleware automatically generates _BEGIN
, _SUCCESS
, _ERROR
actions that are dispatched to the reducer.
A promise based action looks like this:
export function createPromiseAction(type, promise, metaData = {}, promiseTypeSuffixes = ['BEGIN','SUCCESS','ERROR']) {
return {
type,
payload: {promise},
meta: {promiseTypeSuffixes, metaData}
}
}
Is there a way to combine this with this library so the _ERROR
ones do the revert, and the _SUCCESS
ones do the commit?