aboutsummaryrefslogtreecommitdiff
path: root/src/settings/reducers/setting.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/reducers/setting.ts')
-rw-r--r--src/settings/reducers/setting.ts64
1 files changed, 35 insertions, 29 deletions
diff --git a/src/settings/reducers/setting.ts b/src/settings/reducers/setting.ts
index 804853f..31544bb 100644
--- a/src/settings/reducers/setting.ts
+++ b/src/settings/reducers/setting.ts
@@ -1,8 +1,10 @@
-import * as actions from '../actions';
+import * as actions from "../actions";
import {
- JSONTextSettings, FormSettings, SettingSource,
-} from '../../shared/SettingData';
-import { DefaultSetting } from '../../shared/settings/Settings';
+ JSONTextSettings,
+ FormSettings,
+ SettingSource,
+} from "../../shared/SettingData";
+import { DefaultSetting } from "../../shared/settings/Settings";
export interface State {
source: SettingSource;
@@ -13,37 +15,41 @@ export interface State {
const defaultState: State = {
source: SettingSource.JSON,
- json: JSONTextSettings.fromText(''),
+ json: JSONTextSettings.fromText(""),
form: FormSettings.fromSettings(DefaultSetting),
- error: '',
+ error: "",
};
export default function reducer(
state = defaultState,
- action: actions.SettingAction,
+ action: actions.SettingAction
): State {
switch (action.type) {
- case actions.SETTING_SET_SETTINGS:
- return { ...state,
- source: action.source,
- json: action.json,
- form: action.form,
- error: '', };
- case actions.SETTING_SHOW_ERROR:
- return { ...state,
- error: action.error,
- json: action.json, };
- case actions.SETTING_SWITCH_TO_FORM:
- return { ...state,
- error: '',
- source: SettingSource.Form,
- form: action.form, };
- case actions.SETTING_SWITCH_TO_JSON:
- return { ...state,
- error: '',
- source: SettingSource.JSON,
- json: action.json, };
- default:
- return state;
+ case actions.SETTING_SET_SETTINGS:
+ return {
+ ...state,
+ source: action.source,
+ json: action.json,
+ form: action.form,
+ error: "",
+ };
+ case actions.SETTING_SHOW_ERROR:
+ return { ...state, error: action.error, json: action.json };
+ case actions.SETTING_SWITCH_TO_FORM:
+ return {
+ ...state,
+ error: "",
+ source: SettingSource.Form,
+ form: action.form,
+ };
+ case actions.SETTING_SWITCH_TO_JSON:
+ return {
+ ...state,
+ error: "",
+ source: SettingSource.JSON,
+ json: action.json,
+ };
+ default:
+ return state;
}
}