import { Form, FormControl, FormField, FormItem } from "../ui/form"; import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, } from "../ui/input-otp"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { totpSchema, TotpSchema } from "@/schemas/totp-schema"; import { useTranslation } from "react-i18next"; import z from "zod"; interface Props { formId: string; onSubmit: (code: TotpSchema) => void; loading?: boolean; } export const TotpForm = (props: Props) => { const { formId, onSubmit, loading } = props; const { t } = useTranslation(); z.config({ customError: (iss) => iss.input === undefined ? t("fieldRequired") : t("invalidInput"), }); const form = useForm({ resolver: zodResolver(totpSchema), }); return (
( )} /> ); };