aboutsummaryrefslogtreecommitdiff
path: root/src/settings/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
commite1dac618a8b8929f601c7ec8aca3842c5ebf9d03 (patch)
tree6a914a8243c8c02e7752a83667a54d3fa832955c /src/settings/reducers
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
Use plugin:prettier/recommended
Diffstat (limited to 'src/settings/reducers')
-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;
}
}