aboutsummaryrefslogtreecommitdiff
path: root/src/settings/actions
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-10-07 12:54:32 +0000
committerGitHub <noreply@github.com>2019-10-07 12:54:32 +0000
commit8eddcc1785a85bbe74be254d1055ebe5125dad10 (patch)
treef3f51320d12a90a1b421ed8b1f811c576996ea8e /src/settings/actions
parent7fc2bb615f530fc6adfade54b9553568f5d50ceb (diff)
parentb77a4734985722e96066e713f3b1b9e81a6e1811 (diff)
Merge pull request #654 from ueokande/settings-as-a-class
Refactor settings on shared logics
Diffstat (limited to 'src/settings/actions')
-rw-r--r--src/settings/actions/index.ts8
-rw-r--r--src/settings/actions/setting.ts6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/settings/actions/index.ts b/src/settings/actions/index.ts
index b1e996e..dfa41c4 100644
--- a/src/settings/actions/index.ts
+++ b/src/settings/actions/index.ts
@@ -1,5 +1,5 @@
import {
- JSONSettings, FormSettings, SettingSource,
+ JSONTextSettings, FormSettings, SettingSource,
} from '../../shared/SettingData';
// Settings
@@ -11,14 +11,14 @@ export const SETTING_SWITCH_TO_JSON = 'setting.switch.to.json';
interface SettingSetSettingsAcion {
type: typeof SETTING_SET_SETTINGS;
source: SettingSource;
- json?: JSONSettings;
+ json?: JSONTextSettings;
form?: FormSettings;
}
interface SettingShowErrorAction {
type: typeof SETTING_SHOW_ERROR;
error: string;
- json: JSONSettings;
+ json: JSONTextSettings;
}
interface SettingSwitchToFormAction {
@@ -28,7 +28,7 @@ interface SettingSwitchToFormAction {
interface SettingSwitchToJsonAction {
type: typeof SETTING_SWITCH_TO_JSON;
- json: JSONSettings,
+ json: JSONTextSettings,
}
export type SettingAction =
diff --git a/src/settings/actions/setting.ts b/src/settings/actions/setting.ts
index 9eb416e..9404791 100644
--- a/src/settings/actions/setting.ts
+++ b/src/settings/actions/setting.ts
@@ -1,7 +1,7 @@
import * as actions from './index';
import * as storages from '../storage';
import SettingData, {
- JSONSettings, FormSettings, SettingSource,
+ JSONTextSettings, FormSettings, SettingSource,
} from '../../shared/SettingData';
const load = async(): Promise<actions.SettingAction> => {
@@ -26,7 +26,7 @@ const save = async(data: SettingData): Promise<actions.SettingAction> => {
return set(data);
};
-const switchToForm = (json: JSONSettings): actions.SettingAction => {
+const switchToForm = (json: JSONTextSettings): actions.SettingAction => {
try {
// toSettings exercise validation
let form = FormSettings.fromSettings(json.toSettings());
@@ -44,7 +44,7 @@ const switchToForm = (json: JSONSettings): actions.SettingAction => {
};
const switchToJson = (form: FormSettings): actions.SettingAction => {
- let json = JSONSettings.fromSettings(form.toSettings());
+ let json = JSONTextSettings.fromSettings(form.toSettings());
return {
type: actions.SETTING_SWITCH_TO_JSON,
json,