aboutsummaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-08-02 21:35:43 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-08-02 22:09:49 +0900
commitdb9f4306270f2117fd9def8d3b4eeebef983471d (patch)
tree77d2a7c185d8ef8bf456f4ba925415263d13921d /src/settings
parentab9183f575d6b220694006d9b155735eaeb275cd (diff)
Fix error on settings
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/components/index.jsx9
-rw-r--r--src/settings/reducers/setting.js3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/settings/components/index.jsx b/src/settings/components/index.jsx
index 66dc940..9633359 100644
--- a/src/settings/components/index.jsx
+++ b/src/settings/components/index.jsx
@@ -68,6 +68,7 @@ class SettingsComponent extends Component {
render() {
let fields = null;
+ let disabled = this.props.error.length > 0;
if (this.props.source === 'form') {
fields = this.renderFormFields(this.props.form);
} else if (this.props.source === 'json') {
@@ -84,7 +85,8 @@ class SettingsComponent extends Component {
label='Use form'
checked={this.props.source === 'form'}
value='form'
- onChange={this.bindSource.bind(this)} />
+ onChange={this.bindSource.bind(this)}
+ disabled={disabled} />
<Input
type='radio'
@@ -92,8 +94,8 @@ class SettingsComponent extends Component {
label='Use plain JSON'
checked={this.props.source === 'json'}
value='json'
- onChange={this.bindSource.bind(this)} />
-
+ onChange={this.bindSource.bind(this)}
+ disabled={disabled} />
{ fields }
</form>
</div>
@@ -128,6 +130,7 @@ class SettingsComponent extends Component {
} else if (from === 'json' && to === 'form') {
let b = window.confirm(DO_YOU_WANT_TO_CONTINUE);
if (!b) {
+ this.forceUpdate();
return;
}
this.props.dispatch(settingActions.switchToForm(this.props.json));
diff --git a/src/settings/reducers/setting.js b/src/settings/reducers/setting.js
index 8e4a415..54033aa 100644
--- a/src/settings/reducers/setting.js
+++ b/src/settings/reducers/setting.js
@@ -14,11 +14,10 @@ export default function reducer(state = defaultState, action = {}) {
source: action.source,
json: action.json,
form: action.form,
- errors: '',
error: '', };
case actions.SETTING_SHOW_ERROR:
return { ...state,
- error: action.text,
+ error: action.error,
json: action.json, };
case actions.SETTING_SWITCH_TO_FORM:
return { ...state,