fix: user profile data mutation (#1243)

This commit is contained in:
Aaryan Khandelwal 2023-06-07 19:03:49 +05:30 committed by GitHub
parent e949c4e130
commit 42fceb4dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ const Profile: NextPage = () => {
.then((res) => { .then((res) => {
mutateUser((prevData) => { mutateUser((prevData) => {
if (!prevData) return prevData; if (!prevData) return prevData;
return { ...prevData, user: { ...payload, ...res } }; return { ...prevData, ...res };
}, false); }, false);
setIsEditing(false); setIsEditing(false);
setToastAlert({ setToastAlert({
@ -97,7 +97,7 @@ const Profile: NextPage = () => {
if (updateUser) if (updateUser)
userService userService
.updateUser({ avatar: "" }) .updateUser({ avatar: "" })
.then((res) => { .then(() => {
setToastAlert({ setToastAlert({
type: "success", type: "success",
title: "Success!", title: "Success!",
@ -105,7 +105,7 @@ const Profile: NextPage = () => {
}); });
mutateUser((prevData) => { mutateUser((prevData) => {
if (!prevData) return prevData; if (!prevData) return prevData;
return { ...prevData, user: res }; return { ...prevData, avatar: "" };
}, false); }, false);
}) })
.catch(() => { .catch(() => {

View File

@ -191,8 +191,8 @@ const WorkspaceSettings: NextPage = () => {
<div className="relative mx-auto flex h-12 w-12"> <div className="relative mx-auto flex h-12 w-12">
<img <img
src={watch("logo")!} src={watch("logo")!}
alt="Workspace Logo"
className="absolute top-0 left-0 h-full w-full object-cover rounded-md" className="absolute top-0 left-0 h-full w-full object-cover rounded-md"
alt="Workspace Logo"
/> />
</div> </div>
) : ( ) : (