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.
24 lines
586 B
24 lines
586 B
const Immutable = require('immutable');
|
|
|
|
import * as GridActions from '../../actions/board/grid.actions';
|
|
import Values from '../Values';
|
|
|
|
const initial = [];
|
|
|
|
const reducer = (state = initial, action) => {
|
|
if (action.type !== GridActions.GRID_ACTION) {
|
|
return state;
|
|
}
|
|
|
|
switch (action.action) {
|
|
case GridActions.GENERATE:
|
|
return Values.generate(action.count, action.level);
|
|
|
|
case GridActions.UPDATE:
|
|
return Immutable.List(state).set(action.index, action.value).toArray();
|
|
}
|
|
|
|
return state;
|
|
};
|
|
|
|
export default reducer;
|
|
|