Created
April 15, 2017 23:40
-
-
Save Tauka/03feced8cfe9706a238f2799700643d8 to your computer and use it in GitHub Desktop.
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 default function reducer(state={ | |
| data: [], | |
| requestSuccess: false, | |
| requestPending: false, | |
| requestFail: false | |
| }, action) { | |
| switch(action.type) { | |
| case "ACTION_PENDING": { | |
| return {...state, requestPending: true} | |
| } | |
| case "ACTION_SUCCESS": { | |
| return {...state, requestPending: false, requestSuccess: true, data: action.payload} | |
| } | |
| case "ACTION_FAIL": { | |
| return {...state, requestPending: false, requestFail: true} | |
| return state; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment