Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions apps/web/app/(org)/dashboard/settings/account/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading