import { FormEventHandler, useCallback } from 'react' import { Button, ButtonGroup, Form } from 'react-bootstrap' import { useSignIn, useSignUp } from '../hooks/api' import { composeSignUpBody } from '../api/signup' type AuthFormProps = { goBack: () => void, } const AuthForm = ({ goBack }: AuthFormProps) => { const { handleSignUp, signUpButton } = useSignUp() const { handleSignIn, signInButton } = useSignIn() const handleAuth: FormEventHandler = useCallback((e) => { e.preventDefault() e.stopPropagation() const formData = new FormData(e.currentTarget) const register = (e.nativeEvent as SubmitEvent).submitter?.id === 'register' void (async () => { const accountCreated = register ? ( await handleSignUp(composeSignUpBody(formData)) ) : true if (accountCreated) { if (await handleSignIn(formData)) { goBack() } } })() }, [goBack, handleSignUp, handleSignIn]) return (
Как меня называть И я могу доказать, что это я Я согласен с{' '} условиями обработки персональных данных