Created
November 20, 2017 14:04
-
-
Save unel/627a2aef29a292dbcb8e99440f490658 to your computer and use it in GitHub Desktop.
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 default function asyncReducer(state = isLoading, { type, payload }) { | |
switch (type) { | |
case AJAX_CALL_BEGIN: | |
return { ...state, [payload]: 1}; | |
case AJAX_CALL_SUCCESS: | |
return { ...state, [payload]: 0}; | |
case AJAX_CALL_ERROR: | |
return { ...state, [payload.target]: 0, error: payload.error }; | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment