show toast on renaming first/last name to empty string (#1328)

This commit is contained in:
Jayden-Chiu 2021-10-29 05:03:48 -04:00 committed by GitHub
parent 5c17d64463
commit 1aca2b0ea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);