Created
April 3, 2017 06:09
-
-
Save carlosble/cc4bf2a2c6a301971e5a7f5531248ef2 to your computer and use it in GitHub Desktop.
Different kind of actions
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
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