import styles from './Form.module.scss'; import type { FormData, FormProps } from './lib/types'; import { publicRuntimeConfig } from '@/config/runtime'; import { FormStateContext } from '@/context/form-state'; import type { PropsWithChildren } from 'react'; import { useContext } from 'react'; import { useForm } from 'react-hook-form'; const { TELEGRAM_BOT_URL } = publicRuntimeConfig; export function BaseForm({ children, onSubmit }: FormProps & PropsWithChildren) { const { handleSubmit, register } = useForm(); const { state: { error, step, tfa }, } = useContext(FormStateContext); return (
{tfa ? ( Открыть чат с ботом ) : null} {error ? {error} : null} {children}
); }