Skip to content

Commit

Permalink
Add toast for successful profile update
Browse files Browse the repository at this point in the history
Remove console log statements.
Add toast message for successful user profile update.
  • Loading branch information
carriezhengjr committed Nov 14, 2023
1 parent 60428db commit a721617
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/src/pages/users/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,21 @@ const EditProfile: React.FC<EditProfileProps> = ({
languages,
};

console.log('Request Data:', updatedProfile);

const response = new AuthAPI()
new AuthAPI()
.updateUserProfile(updatedProfile)
.then((user) => {
console.log('Response Data:', response);

dispatch(setUser(user));

// Close the modal.
onCloseModal();

toast({
title: 'Profile Updated!',
description: 'Your profile has been successfully updated!',
status: 'success',
duration: 4000,
isClosable: true,
});
})
.catch((err: AxiosError<{ errors: Array<{ msg: string }> }>) => {
console.error('Error updating profile:', err);
Expand Down

0 comments on commit a721617

Please sign in to comment.