Last active
June 5, 2017 12:08
-
-
Save erezrokah/8e69fd8a97a975c6388f4bd8ad05051a 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
//@flow | |
import createReducer from '../createReducer' | |
const initialState = { messages: { inProgress: false, items: { } } } | |
//createReducer taken from here http://redux.js.org/docs/recipes/ReducingBoilerplate.html | |
export const reducer = createReducer(initialState, { | |
['MESSAGES_REQUESTED'](state, action) { | |
const newState = { ...state, | |
messages: { inProgress: true, items: { } } | |
} | |
return newState | |
}, | |
['MESSAGES_FULFILLED'](state, action) { | |
const newState = { ...state, | |
messages: { inProgress: false, items: action.items } | |
} | |
return newState | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment