update initals avatar if user changes name

This commit is contained in:
Danny Liu 2024-04-01 16:23:54 -07:00
parent 40e1e212d4
commit a0a064f4c8

View file

@ -39,6 +39,11 @@
};
const submitHandler = async () => {
const isInitialsImage: boolean = profileImageUrl === generateInitialsImage($user.name) || profileImageUrl === '';
if (isInitialsImage && name !== $user.name) {
profileImageUrl = generateInitialsImage(name);
}
const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
(error) => {
toast.error(error);