From 8d6e6775b135754623bc2ff2eadbbd5f36c2ffe5 Mon Sep 17 00:00:00 2001 From: Rohan Sachdeva Date: Tue, 4 Jun 2024 10:01:46 -0700 Subject: [PATCH] Custom error message when title or subtitle fields are missing --- .../src/app/pages/EmergencyFlow.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/admin-portal-frontend/src/app/pages/EmergencyFlow.tsx b/admin-portal-frontend/src/app/pages/EmergencyFlow.tsx index 759bf51..1aa4428 100644 --- a/admin-portal-frontend/src/app/pages/EmergencyFlow.tsx +++ b/admin-portal-frontend/src/app/pages/EmergencyFlow.tsx @@ -130,8 +130,18 @@ const EmergencyFlow: React.FC = () => { // If the problem is something we don't really control, such as network // issues or an unexpected exception on the server side, then use a // banner, modal, popup, or similar. - - alert(result.error); + if ( + !emergencyTitle || + emergencyTitle == "" || + emergencyTitle === "" || + !emergencySubtitle || + emergencySubtitle == "" || + emergencyTitle === "" + ) { + alert("Missing required title or subtitle fields. Please resubmit the form."); + } else { + alert(result.error); + } console.log(result); } })