diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-08 21:20:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 21:20:49 +0900 |
commit | 37840c2abb02948d36cdcfaab9063f3ea67fdb6b (patch) | |
tree | 2662c396dea1761f57ed508616d2c76389aba5f9 /src/settings/reducers | |
parent | 9f64b19bef06328999a5ed602ba89867402b9d5c (diff) | |
parent | 43beccfe0f323e2363fe97bdb6bc0d71558fda47 (diff) |
Merge pull request #429 from ueokande/use-official-redux
Use official redux
Diffstat (limited to 'src/settings/reducers')
-rw-r--r-- | src/settings/reducers/setting.js | 23 |
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; } } - |