Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save takahirohonda/fd35ced4ed12819d8f577d38fca0ea52 to your computer and use it in GitHub Desktop.
Save takahirohonda/fd35ced4ed12819d8f577d38fca0ea52 to your computer and use it in GitHub Desktop.
calling-async-function-in-action-with-redux-thunk-1
export const getPersonalData = (payload) => (dispatch) => {
// Make AJAX call
return postRequest(payload)
.then((response) => {
// Once AJAX call is successful, update the store
dispatch(setPersonalData(response))
})
.catch(err => dispatch(apiCallNotSuccess()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment