Clean setting

This commit is contained in:
Shin'ya Ueoka 2018-07-08 17:25:34 +09:00
parent 96649fef63
commit df890379ca
5 changed files with 144 additions and 143 deletions

View file

@ -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;
}
}