Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Created April 19, 2016 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanghoang/628c956231185d8633c7bdb59290782b to your computer and use it in GitHub Desktop.
Save khanghoang/628c956231185d8633c7bdb59290782b to your computer and use it in GitHub Desktop.
parrallelPromises
export default function parrallelPromises (store) {
return next => action => {
const { parrallelPromises } = action;
if (!parrallelPromises) {
return next(action);
}
return Promise.props(parrallelPromises)
.then((results) => {
return store.dispatch(results);
})
.catch((error) => {
return store.dispatch({error: error});
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment