authorisation.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React from "react";
  2. import { reduxForm, Field } from "redux-form";
  3. import { Link } from "react-router-dom"
  4. import Authbuttons from './authButtons'
  5. import { authValidate } from "../../utils/authValidate";
  6. import { authRenderField } from "../../common/authRenderField"
  7. const Form = props => {
  8. const { handleSubmit, getUsersData } = props
  9. const submit = (values) => {
  10. getUsersData(values);
  11. }
  12. return (
  13. <div className="formdiv">
  14. <div>
  15. <Authbuttons />
  16. <form className="formAuth" >
  17. <Field
  18. name="email"
  19. component={authRenderField}
  20. type="Емейл"
  21. placeholder="email@example.com"
  22. className="input"
  23. />
  24. <Field
  25. name="password"
  26. component={authRenderField}
  27. type="password"
  28. placeholder="Пароль"
  29. className="input"
  30. />
  31. <div className="center">
  32. <button className="buttonInAuth" onClick={handleSubmit(submit)}>
  33. <Link to="/" className="colorLink" >Войти</Link>
  34. </button>
  35. </div>
  36. </form>
  37. </div>
  38. </div>
  39. );
  40. }
  41. export default reduxForm({ form: "authForm", validate: authValidate })(Form);