const Immutable = require('immutable'); import * as HighScoreActions from '../../actions/high-score/high-score.actions'; const initial = { score: 900, initials: [] }; const reducer = (state = initial, action) => { if (action.type !== HighScoreActions.HIGHSCORE_ACTION) { return state; } switch (action.action) { case HighScoreActions.UPDATE_INITIALS: return Immutable.Map(state) .set('initials', action.initials) .toObject(); case HighScoreActions.UPDATE_SCORE: return Immutable.Map(state) .set('score', action.score) .toObject(); } return state; }; export default reducer;