Created
October 2, 2015 13:45
-
-
Save iamdustan/8a3303c43767fa0ef64d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// our apis return successfully from an HTTP/fetch promise standpoint for | |
// response payloads with error codes. We would like the reducer to receive this | |
// an rejection and not have to manage unwrapping that itself. | |
export default () => next => action => | |
action.type === 'FETCH' | |
? next(action).then(res => res.hasOwnProperty('error') ? Promise.reject(res) : res) | |
: next(action); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment