aboutsummaryrefslogtreecommitdiff
path: root/src/background/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-01-11 13:02:14 +0000
committerGitHub <noreply@github.com>2018-01-11 13:02:14 +0000
commitf5dfdb0bd7ab850c77cae523928c876fe5e002fa (patch)
tree083a7c9dcd4e85daef7f8323067454b48730c6e6 /src/background/reducers
parentc3d1535224231cd379cf503a4c4937342ef27383 (diff)
parentfad8f96a663d83792138cc986474ec4228b6c6c9 (diff)
Merge pull request #303 from ueokande/properties
Properties support
Diffstat (limited to 'src/background/reducers')
-rw-r--r--src/background/reducers/index.js2
-rw-r--r--src/background/reducers/setting.js24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/background/reducers/index.js b/src/background/reducers/index.js
index 4be8fac..dab0c62 100644
--- a/src/background/reducers/index.js
+++ b/src/background/reducers/index.js
@@ -1,4 +1,4 @@
-import settingReducer from 'settings/reducers/setting';
+import settingReducer from './setting';
// Make setting reducer instead of re-use
const defaultState = {
diff --git a/src/background/reducers/setting.js b/src/background/reducers/setting.js
new file mode 100644
index 0000000..045a654
--- /dev/null
+++ b/src/background/reducers/setting.js
@@ -0,0 +1,24 @@
+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: Object.assign({}, state.value, {
+ properties: Object.assign({}, state.value.properties,
+ { [action.name]: action.value })
+ })
+ };
+ default:
+ return state;
+ }
+}
+