From 83206ed26fb724d8799f776fe8875fe844a79d7d Mon Sep 17 00:00:00 2001 From: riahk Date: Wed, 16 Dec 2020 11:24:00 -0800 Subject: [PATCH] add error handling on create --- .../src/views/CRUD/alert/AlertReportModal.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index b6f3be214b9da..52c3cac735cb6 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -578,8 +578,8 @@ const AlertReportModal: FunctionComponent = ({ delete data.last_value; delete data.last_value_row_json; - updateResource(update_id, data).then(result => { - if (!result) { + updateResource(update_id, data).then(response => { + if (!response) { return; } @@ -593,6 +593,10 @@ const AlertReportModal: FunctionComponent = ({ } else if (currentAlert) { // Create createResource(data).then(response => { + if (!response) { + return; + } + if (onAdd) { onAdd(response); }