Candidate swapping button

This commit is contained in:
Rodrigo Pedroso 2019-06-21 00:59:25 -04:00
commit a2b8e7480e
6 changed files with 77 additions and 34 deletions

View file

@ -1,8 +1,10 @@
import { ADD_ARTICLE } from '../constants/action-types'
import { SET_CANDIDATE } from '../constants/action-types'
const initialState = {
articles: [],
remoteArticles: []
remoteArticles: [],
candidate: ''
}
function rootReducer(state = initialState, action) {
@ -12,6 +14,12 @@ function rootReducer(state = initialState, action) {
})
}
else if (action.type === SET_CANDIDATE) {
return Object.assign({}, state, {
candidate: action.payload
})
}
else if (action.type === "DATA_LOADED") {
return Object.assign({}, state, {
remoteArticles: state.remoteArticles.concat(action.payload.message.statuses)