You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
721 B

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;