aboutsummaryrefslogtreecommitdiff
path: root/src/settings/reducers
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/reducers')
-rw-r--r--src/settings/reducers/setting.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/settings/reducers/setting.ts b/src/settings/reducers/setting.ts
index 47c21bf..c4a21c7 100644
--- a/src/settings/reducers/setting.ts
+++ b/src/settings/reducers/setting.ts
@@ -1,23 +1,25 @@
import * as actions from '../actions';
+import {
+ JSONSettings, FormSettings, SettingSource,
+} from '../../shared/SettingData';
-interface State {
- source: string;
- json: string;
- form: any;
+export interface State {
+ source: SettingSource;
+ json?: JSONSettings;
+ form?: FormSettings;
error: string;
}
const defaultState: State = {
- source: '',
- json: '',
- form: null,
+ source: SettingSource.JSON,
+ json: JSONSettings.valueOf(''),
error: '',
};
export default function reducer(
state = defaultState,
action: actions.SettingAction,
-) {
+): State {
switch (action.type) {
case actions.SETTING_SET_SETTINGS:
return { ...state,
@@ -32,12 +34,12 @@ export default function reducer(
case actions.SETTING_SWITCH_TO_FORM:
return { ...state,
error: '',
- source: 'form',
+ source: SettingSource.Form,
form: action.form, };
case actions.SETTING_SWITCH_TO_JSON:
return { ...state,
error: '',
- source: 'json',
+ source: SettingSource.JSON,
json: action.json, };
default:
return state;