Last active
October 7, 2017 19:15
-
-
Save vzaidman/406c0268eeb0600e1c505b099b9aebcc to your computer and use it in GitHub Desktop.
Creation of an Async Action Creator
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 fetchTodos = makeAsyncActionCreator('FETCH_TODOS') | |
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
fetchProfile() | |
// ⇒ { type: 'FETCH_PROFILE@ASYNC_REQUEST' } | |
fetchProfile.cancel()) | |
// ⇒ { type: 'FETCH_PROFILE@ASYNC_CANCEL' } | |
fetchProfile.success(profile) | |
// ⇒ { type: 'FETCH_PROFILE@ASYNC_SUCCESS', payload: profile } | |
fetchProfile.failure(error) | |
// ⇒ { type: 'FETCH_PROFILE@ASYNC_FAILURE' payload: error } | |
fetchProfile.progress(progress) | |
// ⇒ { type: 'FETCH_PROFILE@ASYNC_PROGRESS', payload: progress } | |
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
dispatch(fetchProfile()) | |
// ⇒ dispatch({ type: 'FETCH_PROFILE@ASYNC_REQUEST' })) | |
dispatch(fetchProfile.success(profile)) | |
// ⇒ dispatch({ type: 'FETCH_PROFILE@ASYNC_SUCCESS', payload: profile }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment