Last active
December 27, 2015 23:34
-
-
Save cherta/b09b7793322fe52da2ba to your computer and use it in GitHub Desktop.
Testing async actions on redux without following the manual - gist 2 Raw
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 function getPost(postId) { | |
return function (dispatch, getState) { | |
$ | |
.getJSON('/posts/' + posotId) | |
.done(function (postData) { | |
dispatch( { type: 'SHOW_POST', post: postData } ) | |
}) | |
.fail(function (postData) { | |
dispatch( { type: 'SHOW_ERROR' } ) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment