import React, { memo, useCallback } from "react" import styles from "./styles.module.scss" import { AppDispatch } from "../../store" import { fetchVolunteerLogin } from "../../store/volunteerLogin" interface Props { dispatch: AppDispatch error: string } const LoginForm = ({ dispatch, error }: Props): JSX.Element => { const onSubmit = useCallback( (event: React.SyntheticEvent): void => { event.preventDefault() const target = event.target as typeof event.target & { email: { value: string } password: { value: string } } const email = target.email.value const password = target.password.value dispatch(fetchVolunteerLogin({ email, password })) }, [dispatch] ) return (
Connectez-vous pour accéder à votre espace.
{error}
) } export default memo(LoginForm)