Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 3, 2017 06:09
Show Gist options
  • Save carlosble/cc4bf2a2c6a301971e5a7f5531248ef2 to your computer and use it in GitHub Desktop.
Save carlosble/cc4bf2a2c6a301971e5a7f5531248ef2 to your computer and use it in GitHub Desktop.
Different kind of actions
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
});
});
};
}
export function changeProfile(fieldName, fieldValue) {
return {
type: types.CHANGE_PROFILE,
fieldName: fieldName,
fieldValue: fieldValue
};
}
export function saveProfile(profile, serverApi) {
return serverApi.saveProfile(profile).then((json) => {
return json;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment