forked from M-Labs/web2019
fix JSON validation
This commit is contained in:
parent
61b291b9e0
commit
8c3a35cea4
|
@ -183,10 +183,6 @@ class Layout extends React.PureComponent {
|
||||||
checkValidation(conf) {
|
checkValidation(conf) {
|
||||||
let conf_obj;
|
let conf_obj;
|
||||||
|
|
||||||
if (!conf) {
|
|
||||||
conf = this.state.customconf;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conf_obj = JSON.parse(conf);
|
conf_obj = JSON.parse(conf);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -281,7 +277,7 @@ class Layout extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickLoad() {
|
handleClickLoad() {
|
||||||
this.checkValidation();
|
this.checkValidation(this.state.customconf);
|
||||||
|
|
||||||
if (this.props.onClickLoadCustomConf) {
|
if (this.props.onClickLoadCustomConf) {
|
||||||
this.props.onClickLoadCustomConf(this.state.customconf_ready);
|
this.props.onClickLoadCustomConf(this.state.customconf_ready);
|
||||||
|
|
|
@ -227,10 +227,6 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) {
|
||||||
value: function checkValidation(conf) {
|
value: function checkValidation(conf) {
|
||||||
var conf_obj;
|
var conf_obj;
|
||||||
|
|
||||||
if (!conf) {
|
|
||||||
conf = this.state.customconf;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conf_obj = JSON.parse(conf);
|
conf_obj = JSON.parse(conf);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -315,7 +311,7 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) {
|
||||||
}, {
|
}, {
|
||||||
key: "handleClickLoad",
|
key: "handleClickLoad",
|
||||||
value: function handleClickLoad() {
|
value: function handleClickLoad() {
|
||||||
this.checkValidation();
|
this.checkValidation(this.state.customconf);
|
||||||
|
|
||||||
if (this.props.onClickLoadCustomConf) {
|
if (this.props.onClickLoadCustomConf) {
|
||||||
this.props.onClickLoadCustomConf(this.state.customconf_ready);
|
this.props.onClickLoadCustomConf(this.state.customconf_ready);
|
||||||
|
|
Loading…
Reference in New Issue