aboutsummaryrefslogtreecommitdiff
path: root/src/reducers/input.js
blob: 2e4bcd822a87296363f9b708d898788b4958972e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import actions from 'actions';

const defaultState = {
  keys: '',
};

export default function reducer(state = defaultState, action = {}) {
  switch (action.type) {
  case actions.INPUT_KEY_PRESS:
    return Object.assign({}, state, {
      keys: state.keys + action.key
    });
  case actions.INPUT_CLEAR_KEYS:
    return Object.assign({}, state, {
      keys: '',
    });
  default:
    return state;
  }
}