From 8c3a35cea438fe06cf4636f1406ffaa82267f4e9 Mon Sep 17 00:00:00 2001 From: occheung Date: Tue, 1 Jun 2021 11:42:46 +0800 Subject: [PATCH] fix JSON validation --- static/js/shop.jsx | 6 +----- static/js/shop.min.js | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/static/js/shop.jsx b/static/js/shop.jsx index 6ca3d64..2ec3914 100644 --- a/static/js/shop.jsx +++ b/static/js/shop.jsx @@ -183,10 +183,6 @@ class Layout extends React.PureComponent { checkValidation(conf) { let conf_obj; - if (!conf) { - conf = this.state.customconf; - } - try { conf_obj = JSON.parse(conf); } catch (e) { @@ -281,7 +277,7 @@ class Layout extends React.PureComponent { } handleClickLoad() { - this.checkValidation(); + this.checkValidation(this.state.customconf); if (this.props.onClickLoadCustomConf) { this.props.onClickLoadCustomConf(this.state.customconf_ready); diff --git a/static/js/shop.min.js b/static/js/shop.min.js index 753cbcb..d4e6f9e 100644 --- a/static/js/shop.min.js +++ b/static/js/shop.min.js @@ -227,10 +227,6 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) { value: function checkValidation(conf) { var conf_obj; - if (!conf) { - conf = this.state.customconf; - } - try { conf_obj = JSON.parse(conf); } catch (e) { @@ -315,7 +311,7 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) { }, { key: "handleClickLoad", value: function handleClickLoad() { - this.checkValidation(); + this.checkValidation(this.state.customconf); if (this.props.onClickLoadCustomConf) { this.props.onClickLoadCustomConf(this.state.customconf_ready);