From 1aca2b0ea0a287fff9f35bdd93309e7541dcd734 Mon Sep 17 00:00:00 2001 From: Jayden-Chiu <57676066+Jayden-Chiu@users.noreply.github.com> Date: Fri, 29 Oct 2021 05:03:48 -0400 Subject: [PATCH] show toast on renaming first/last name to empty string (#1328) --- frontend/src/SettingsPage/SettingsPage.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/SettingsPage/SettingsPage.jsx b/frontend/src/SettingsPage/SettingsPage.jsx index 283e6450f7..3f8c7b01ae 100644 --- a/frontend/src/SettingsPage/SettingsPage.jsx +++ b/frontend/src/SettingsPage/SettingsPage.jsx @@ -14,6 +14,13 @@ function SettingsPage(props) { const [passwordChangeInProgress, setPasswordChangeInProgress] = React.useState(false); const updateDetails = async () => { + if (!firstName || !lastName) { + toast.warn("Name can't be empty!", { + hideProgressBar: true, + position: 'top-left', + }); + return; + } setUpdateInProgress(true); const updatedDetails = await userService.updateCurrentUser(firstName, lastName); authenticationService.updateCurrentUserDetails(updatedDetails);