You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/08/26 07:29:40 UTC

[apisix-dashboard] branch master updated: fix: submit setting grafanaURl without validation (#413)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new d006c66  fix: submit setting grafanaURl without validation (#413)
d006c66 is described below

commit d006c662a5b96b23a6161919cc7f3ccdca62bf70
Author: liuxiran <be...@126.com>
AuthorDate: Wed Aug 26 15:29:31 2020 +0800

    fix: submit setting grafanaURl without validation (#413)
---
 src/pages/Setting/Setting.tsx | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/pages/Setting/Setting.tsx b/src/pages/Setting/Setting.tsx
index 65c1dab..3ef8141 100644
--- a/src/pages/Setting/Setting.tsx
+++ b/src/pages/Setting/Setting.tsx
@@ -46,24 +46,25 @@ const Setting: React.FC = () => {
   }, [canFetchGrafana]);
 
   const onSubmit = () => {
-    const { grafanaURL } = form.getFieldsValue();
-    Promise.all([
-      new Promise((resolve) => {
-        if (canFetchGrafana) {
-          updateMonitorURL(grafanaURL).then(resolve);
-        }
-        resolve();
-      }),
-    ]).then(() => {
-      notification.success({
-        message: formatMessage({
-          id: 'page.setting.notification.update.configuration.successfully',
+    form.validateFields().then((value) => {
+      Promise.all([
+        new Promise((resolve) => {
+          if (canFetchGrafana) {
+            updateMonitorURL(value.grafanaURL).then(resolve);
+          }
+          resolve();
         }),
+      ]).then(() => {
+        notification.success({
+          message: formatMessage({
+            id: 'page.setting.notification.update.configuration.successfully',
+          }),
+        });
+        setTimeout(() => {
+          const redirect = getUrlQuery('redirect');
+          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+        }, 500);
       });
-      setTimeout(() => {
-        const redirect = getUrlQuery('redirect');
-        window.location.href = redirect ? decodeURIComponent(redirect) : '/';
-      }, 500);
     });
   };