feat: implement credentials login
implements the credentials login functionality
This commit is contained in:
parent
210bd132cc
commit
4e87c11ec3
10 changed files with 522 additions and 115 deletions
14
src/lib/hooks/useZodForm.tsx
Normal file
14
src/lib/hooks/useZodForm.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
|
||||
export default function useZodForm<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Schema extends z.ZodType<any, any, any>,
|
||||
Values extends z.infer<Schema>,
|
||||
>(schema: Schema, defaultValues?: Values) {
|
||||
return useForm<Values>({
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues,
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue