Skip to content

Instantly share code, notes, and snippets.

@cherta
Last active December 27, 2015 23:34
Show Gist options
  • Save cherta/b09b7793322fe52da2ba to your computer and use it in GitHub Desktop.
Save cherta/b09b7793322fe52da2ba to your computer and use it in GitHub Desktop.
Testing async actions on redux without following the manual - gist 2 Raw
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