Commit a0a064f4 authored by Danny Liu's avatar Danny Liu
Browse files

update initals avatar if user changes name

parent 40e1e212
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
}; };
const submitHandler = async () => { 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( const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch(
(error) => { (error) => {
toast.error(error); toast.error(error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment