RegisterForm.jsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { useState } from 'react'
  2. import { connect } from 'react-redux'
  3. import { Button, Input, Checkbox, Form, Row, Col } from 'antd'
  4. import { Link } from 'react-router-dom'
  5. import { message } from 'antd'
  6. import { useEffect } from 'react'
  7. import { ImportOutlined } from '@ant-design/icons'
  8. import {
  9. actionRegisterTypeSaga,
  10. } from '../../redux/saga'
  11. import InitialForm from './InitialForm'
  12. const RegisterForm = ({ onLogin, children, register }) => {
  13. useEffect(() => {
  14. if (register?.status === 'FULFILLED' && register?.payload === null) {
  15. message.error({
  16. content: 'This login is already in the database',
  17. style: {
  18. marginTop: '80px',
  19. },
  20. })
  21. }
  22. }, [register])
  23. return (
  24. <InitialForm onLogin={onLogin}>
  25. {"Register"}
  26. </InitialForm>
  27. )
  28. }
  29. export const CRegisterForm = connect(
  30. (state) => ({
  31. children: `Register`,
  32. register: state.promise?.register,
  33. }),
  34. {
  35. onLogin: actionRegisterTypeSaga,
  36. },
  37. )(RegisterForm)