Last active
July 30, 2019 02:44
-
-
Save dewey92/4f58c62287968e19bb953caa49184c0d to your computer and use it in GitHub Desktop.
Invalidate the invalids
This file contains hidden or 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 AsyncState = { // <- HERE | |
| initial: 'initial', | |
| fetching: 'fetching', | |
| success: 'success', | |
| error: 'error' | |
| } | |
| const initialState = { | |
| asyncState: AsyncState.initial, | |
| }; | |
| export default (state = initialState, action) => { | |
| switch(action.type) { | |
| case 'GET_XXX_REQUEST': | |
| return { | |
| ...state, | |
| asyncState: AsyncState.fetching // <- Here | |
| } | |
| case 'GET_XXX_SUCCESS': | |
| return { | |
| ...state, | |
| asyncState: AsyncState.success // <- Here | |
| } | |
| case 'GET_XXX_FAILED': | |
| return { | |
| ...state, | |
| asyncState: AsyncState.error // <- Here | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment