diff --git a/src/components/LoginForm/LoginForm.jsx b/src/components/LoginForm/LoginForm.jsx new file mode 100644 index 0000000..05edfc7 --- /dev/null +++ b/src/components/LoginForm/LoginForm.jsx @@ -0,0 +1,36 @@ +import { useDispatch } from 'react-redux'; +import { logIn } from '../../redux/auth/authOperations'; + +const LoginForm = () => { + const dispatch = useDispatch(); + + const handleSubmit = e => { + e.preventDefault(); + const form = e.currentTarget; + + dispatch( + logIn({ + email: form.elements.email.value, + password: form.elements.password.value, + }) + ); + + form.reset(); + }; + + return ( +
+ ); +}; + +export default LoginForm;