Created
April 19, 2016 15:30
-
-
Save khanghoang/628c956231185d8633c7bdb59290782b to your computer and use it in GitHub Desktop.
parrallelPromises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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