Skip to content

Commit

Permalink
🐛 Fix name change (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella authored Oct 9, 2024
1 parent 18dbb75 commit c339602
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import { useForm } from "react-hook-form";
import { ProfilePicture } from "@/app/[locale]/(admin)/settings/profile/profile-picture";
import { Trans } from "@/components/trans";
import { useUser } from "@/components/user-provider";
import { trpc } from "@/utils/trpc/client";

export const ProfileSettings = () => {
const { user, refresh } = useUser();

const changeName = trpc.user.changeName.useMutation();
const form = useForm<{
name: string;
email: string;
Expand All @@ -32,7 +33,8 @@ export const ProfileSettings = () => {
<Form {...form}>
<form
onSubmit={handleSubmit(async (data) => {
await refresh({ name: data.name });
await changeName.mutateAsync({ name: data.name });
await refresh();
reset(data);
})}
>
Expand Down

0 comments on commit c339602

Please sign in to comment.