aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reducers/index.js
blob: 962d83c2aabedb0ffc5d09f3c2fa09f81761bd62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const initialState = {
  devices: [],
  positions: [],
  events: []
};

function rootReducer(state = initialState, action) {
  switch (action.type) {
    case 'UPDATE_DEVICES':
      return Object.assign({}, {
        ...state,
        devices: [...state.devices, ...action.devices]
      });
    case 'UPDATE_POSITIONS':
      return Object.assign({}, {
        ...state,
        positions: [...state.positions, ...action.positions]
      });
    default:
      return state;
  }
}

export default rootReducer