Skip to content

Commit

Permalink
infer schema type directly
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev committed Jan 8, 2025
1 parent e73b85f commit af44829
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/Users/CreateUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ export default function CreateUserForm({ onSubmitSuccess }: Props) {
path: ["c_password"],
});

type UserFormValues = z.infer<typeof userFormSchema>;

const form = useForm<UserFormValues>({
const form = useForm<z.infer<typeof userFormSchema>>({
mode: "onChange",
resolver: zodResolver(userFormSchema),
defaultValues: {
Expand Down Expand Up @@ -129,7 +127,7 @@ export default function CreateUserForm({ onSubmitSuccess }: Props) {
},
});

const onSubmit = (data: UserFormValues) => {
const onSubmit = (data: z.infer<typeof userFormSchema>) => {
createUser({
...data,
c_password: undefined,
Expand Down

0 comments on commit af44829

Please sign in to comment.