From af4482942a7e7131e74a0cf2f92e3cde2290bfdf Mon Sep 17 00:00:00 2001 From: totregex Date: Wed, 8 Jan 2025 07:48:23 +0530 Subject: [PATCH] infer schema type directly --- src/components/Users/CreateUserForm.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Users/CreateUserForm.tsx b/src/components/Users/CreateUserForm.tsx index a87acc0bb0d..d222de4a931 100644 --- a/src/components/Users/CreateUserForm.tsx +++ b/src/components/Users/CreateUserForm.tsx @@ -90,9 +90,7 @@ export default function CreateUserForm({ onSubmitSuccess }: Props) { path: ["c_password"], }); - type UserFormValues = z.infer; - - const form = useForm({ + const form = useForm>({ mode: "onChange", resolver: zodResolver(userFormSchema), defaultValues: { @@ -129,7 +127,7 @@ export default function CreateUserForm({ onSubmitSuccess }: Props) { }, }); - const onSubmit = (data: UserFormValues) => { + const onSubmit = (data: z.infer) => { createUser({ ...data, c_password: undefined,