summaryrefslogtreecommitdiff
path: root/app/client/live/reducer.js
blob: 9d41c6f7f06b3b854660dde873ad5fea617e80d1 (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
25
26
27
28
29
30
31
32
33
34
35
import { combineReducers } from 'redux'

const liveInitialState = {
  loading: false,
  error: null,
  opt: {},
}

const liveReducer = (state = liveInitialState, action) => {
  let results;

  switch(action.type) {
    case 'LIVE_LOAD_OPT_FROM_SERVER':
      return {
        ...state,
        loading: false,
        error: null,
        opt: action.opt,
      }

    case 'LIVE_SET_OPT':
      return {
        ...state,
        opt: {
          ...state.opt,
          [action.key]: action.value,
        }
      }

    default:
      return state
  }
}

export default liveReducer