Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 5, 2017 22:04
Show Gist options
  • Save carlosble/76e8e4d8013a36cf465e5f71bf96dd82 to your computer and use it in GitHub Desktop.
Save carlosble/76e8e4d8013a36cf465e5f71bf96dd82 to your computer and use it in GitHub Desktop.
Asynchronous action populating the store with data from the server
function loadProfile(serverApi) {
return function (dispatch) {
return serverApi.getProfile().then((json) => {
return dispatch({
type: types.GET_PROFILE,
profile: json
});
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment