aboutsummaryrefslogtreecommitdiff
path: root/src/settings/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-08 17:25:34 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-08 17:27:30 +0900
commitdf890379ca3e41bc20a80fca98a4c3363aecffa9 (patch)
tree761c4128fda14f7172ed777df100abd1e95718de /src/settings/reducers
parent96649fef63f467d45aefee93dfb599546151c21d (diff)
Clean setting
Diffstat (limited to 'src/settings/reducers')
-rw-r--r--src/settings/reducers/setting.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/settings/reducers/setting.js b/src/settings/reducers/setting.js
index 70c6183..8e4a415 100644
--- a/src/settings/reducers/setting.js
+++ b/src/settings/reducers/setting.js
@@ -4,20 +4,33 @@ const defaultState = {
source: '',
json: '',
form: null,
- value: {}
+ error: '',
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.SETTING_SET_SETTINGS:
- return {
+ return { ...state,
source: action.source,
json: action.json,
form: action.form,
- value: action.value,
- };
+ errors: '',
+ error: '', };
+ case actions.SETTING_SHOW_ERROR:
+ return { ...state,
+ error: action.text,
+ json: action.json, };
+ case actions.SETTING_SWITCH_TO_FORM:
+ return { ...state,
+ error: '',
+ source: 'form',
+ form: action.form, };
+ case actions.SETTING_SWITCH_TO_JSON:
+ return { ...state,
+ error: '',
+ source: 'json',
+ json: action.json, };
default:
return state;
}
}
-