🐛 Fix name change (#1384)

This commit is contained in:
Luke Vella 2024-10-09 17:53:28 +01:00 committed by GitHub
parent 18dbb750f2
commit c3396020cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
@ -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);
})}
>