Remove old frontend
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
13
apps/console/src/hooks/useFormWithSchema.ts
Normal file
13
apps/console/src/hooks/useFormWithSchema.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useForm } from "react-hook-form";
|
||||
import type { z, ZodType } from "zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
|
||||
export function useFormWithSchema<T extends ZodType<any, any, any>>(
|
||||
schema: T,
|
||||
options: Parameters<typeof useForm<z.infer<T>>>[0]
|
||||
) {
|
||||
return useForm<z.infer<T>>({
|
||||
...options,
|
||||
resolver: zodResolver(schema),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user