Created
June 19, 2019 17:18
-
-
Save asherccohen/837b0a2f842b4b9637a72a4e64e64b18 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
| // events/reducer.js | |
| const initialState = { todos: [] }; | |
| export const eventsReducer = (state = initialState, action) => { | |
| switch(action.type) { | |
| case 'GET_EVENTS_REQUEST': | |
| return { ...state, isFetching: true }; | |
| case 'GET_EVENTS_SUCCESS': | |
| return { ...state, isFetching: false, todos: action.payload }; | |
| case 'GET_EVENTS_FAILURE': | |
| return { ...state, isFetching: false, errorMessage: action.payload.message }; | |
| default: | |
| return state; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment