Last active
April 16, 2017 00:29
-
-
Save Tauka/4783d7c2384578a09a90a7f129e5cc2f 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
| export function typicalAction(loadingCb, successCb, failCb) { | |
| return function(dispatch) { | |
| loadingCb(); | |
| fetch(`http://someapi/user`) | |
| .then((response) => { | |
| dispatch({type: "ACTION_SUCCESS", payload: response}); | |
| successCb(); | |
| }) | |
| .catch((err) => { | |
| failCb(); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment