add setting actions in content
This commit is contained in:
parent
7639e99b75
commit
c6eb5553d0
10 changed files with 74 additions and 25 deletions
|
@ -1,10 +1,12 @@
|
|||
import addonReducer from './addon';
|
||||
import settingReducer from './setting';
|
||||
import inputReducer from './input';
|
||||
import followReducer from './follow';
|
||||
|
||||
// Make setting reducer instead of re-use
|
||||
const defaultState = {
|
||||
addon: addonReducer(undefined, {}),
|
||||
setting: settingReducer(undefined, {}),
|
||||
input: inputReducer(undefined, {}),
|
||||
follow: followReducer(undefined, {}),
|
||||
};
|
||||
|
@ -12,6 +14,7 @@ const defaultState = {
|
|||
export default function reducer(state = defaultState, action = {}) {
|
||||
return Object.assign({}, state, {
|
||||
addon: addonReducer(state.addon, action),
|
||||
setting: settingReducer(state.setting, action),
|
||||
input: inputReducer(state.input, action),
|
||||
follow: followReducer(state.follow, action),
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import actions from 'content/actions';
|
||||
|
||||
const defaultState = {
|
||||
keys: '',
|
||||
keymaps: {},
|
||||
keys: ''
|
||||
};
|
||||
|
||||
export default function reducer(state = defaultState, action = {}) {
|
||||
|
@ -15,10 +14,6 @@ export default function reducer(state = defaultState, action = {}) {
|
|||
return Object.assign({}, state, {
|
||||
keys: '',
|
||||
});
|
||||
case actions.INPUT_SET_KEYMAPS:
|
||||
return Object.assign({}, state, {
|
||||
keymaps: action.keymaps,
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
13
src/content/reducers/setting.js
Normal file
13
src/content/reducers/setting.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import actions from 'content/actions';
|
||||
|
||||
const defaultState = {};
|
||||
|
||||
export default function reducer(state = defaultState, action = {}) {
|
||||
switch (action.type) {
|
||||
case actions.SETTING_SET:
|
||||
return Object.assign({}, action.value);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
Reference in a new issue