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

const defaultState = {
  value: {},
};

export default function reducer(state = defaultState, action = {}) {
  switch (action.type) {
  case actions.SETTING_SET_SETTINGS:
    return {
      value: action.value,
    };
  case actions.SETTING_SET_PROPERTY:
    return {
      value: { ...state.value,
        properties: { ...state.value.properties, [action.name]: action.value }}
    };
  default:
    return state;
  }
}