From 0a99a02e3070e1f7dfbea5046a8005c9f668bb63 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:32:03 +0300 Subject: [PATCH 1/3] Update Settings.tsx --- .../(org)/dashboard/settings/account/Settings.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx index 0aff8d02cd9..e97793dfe85 100644 --- a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx +++ b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx @@ -18,13 +18,17 @@ export const Settings = ({ const { mutate: updateName, isPending: updateNamePending } = useMutation({ mutationFn: async () => { - await fetch("/api/settings/user/name", { + const res = await fetch("/api/settings/user/name", { method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ firstName, lastName }), + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + firstName: firstName.trim(), + lastName: lastName.trim() ? lastName.trim() : null, + }), }); + if (!res.ok) { + throw new Error("Failed to update name"); + } }, onSuccess: () => { toast.success("Name updated successfully"); From 3352f4c76a3791a26eb5d93de2c50b323b63f979 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:33:03 +0300 Subject: [PATCH 2/3] Update Settings.tsx --- apps/web/app/(org)/dashboard/settings/account/Settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx index e97793dfe85..4e41ab7fbd1 100644 --- a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx +++ b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx @@ -27,7 +27,7 @@ export const Settings = ({ }), }); if (!res.ok) { - throw new Error("Failed to update name"); + toast.error("Failed to update name"); } }, onSuccess: () => { From 5473c2abe483486ff05b246bbfdb485309aa5ccd Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:36:33 +0300 Subject: [PATCH 3/3] Update Settings.tsx --- apps/web/app/(org)/dashboard/settings/account/Settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx index 4e41ab7fbd1..e97793dfe85 100644 --- a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx +++ b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx @@ -27,7 +27,7 @@ export const Settings = ({ }), }); if (!res.ok) { - toast.error("Failed to update name"); + throw new Error("Failed to update name"); } }, onSuccess: () => {