Merge profile updates in context to avoid losing fields
cgen-ecc6e63dc28e484c864c2300cbf2f9e4
This commit is contained in:
parent
3ca76670a5
commit
b36b529e70
1 changed files with 2 additions and 1 deletions
|
|
@ -235,12 +235,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||
user.id,
|
||||
updates,
|
||||
);
|
||||
setProfile(updatedProfile);
|
||||
setProfile((prev) => ({ ...(prev || {} as any), ...(updatedProfile || {} as any), ...updates } as any));
|
||||
aethexToast.success({
|
||||
title: "Profile updated",
|
||||
description: "Your profile has been updated successfully",
|
||||
});
|
||||
} catch (error: any) {
|
||||
setProfile((prev) => ({ ...(prev || {} as any), ...updates } as any));
|
||||
aethexToast.error({
|
||||
title: "Update failed",
|
||||
description: error.message,
|
||||
|
|
|
|||
Loading…
Reference in a new issue