Trump stream

This commit is contained in:
Rodrigo Pedroso 2019-06-25 11:07:16 -04:00
commit fb4fa3cecb
5 changed files with 96 additions and 23 deletions

View file

@ -1,12 +1,14 @@
import { ADD_ARTICLE } from '../constants/action-types'
import { SET_CANDIDATE } from '../constants/action-types'
import { DATA_LOADED } from '../constants/action-types'
import { DATA_LOADED_TO_ADD } from '../constants/action-types'
import { DATA_LOADED_TO_HILLARY } from '../constants/action-types'
import { DATA_LOADED_TO_TRUMP } from '../constants/action-types'
const initialState = {
articles: [],
remoteArticles: [],
remoteArticlesHillary: [],
remoteArticlesTrump: [],
candidate: ''
}
@ -29,12 +31,18 @@ function rootReducer(state = initialState, action) {
})
}
else if (action.type === DATA_LOADED_TO_ADD) {
else if (action.type === DATA_LOADED_TO_HILLARY) {
return Object.assign({}, state, {
remoteArticlesHillary: state.remoteArticlesHillary.concat(action.payload)
})
}
else if (action.type === DATA_LOADED_TO_TRUMP) {
return Object.assign({}, state, {
remoteArticlesTrump: state.remoteArticlesTrump.concat(action.payload)
})
}
return state
}