Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 3, 2017 21:23
Show Gist options
  • Save carlosble/1f78f0ef6e198c637a91e9ace3ebb2d2 to your computer and use it in GitHub Desktop.
Save carlosble/1f78f0ef6e198c637a91e9ace3ebb2d2 to your computer and use it in GitHub Desktop.
Action creator that combines async request to the server
import * as types from '../constants/actionTypes';
export 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