Created
July 24, 2019 07:45
-
-
Save takahirohonda/fd35ced4ed12819d8f577d38fca0ea52 to your computer and use it in GitHub Desktop.
calling-async-function-in-action-with-redux-thunk-1
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
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