2019-06-19 16:37:03 -04:00
|
|
|
import { ADD_ARTICLE } from '../constants/action-types'
|
2019-06-19 14:24:21 -04:00
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
articles: []
|
|
|
|
}
|
|
|
|
|
|
|
|
function rootReducer(state = initialState, action) {
|
|
|
|
if (action.type === ADD_ARTICLE) {
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
articles: state.articles.concat(action.payload)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
|
|
|
|
export default rootReducer
|