|
@@ -5,6 +5,7 @@ import ExistingLoginError from "../../Components/RegistrationError/ExistingLogin
|
|
|
import ConfirmPasswordError from "../../Components/RegistrationError/ConfirmPasswordError";
|
|
|
import {connect} from "react-redux";
|
|
|
import {actionRegistrations} from "../../Actions/action_registration";
|
|
|
+import Button from "../../Components/Button/Button";
|
|
|
|
|
|
const Registration = ({onRegistration}) => {
|
|
|
|
|
@@ -23,6 +24,15 @@ const Registration = ({onRegistration}) => {
|
|
|
else return true
|
|
|
}
|
|
|
|
|
|
+ const registrationCallback = () => {
|
|
|
+ if(isRegistrationValid()) {
|
|
|
+ onRegistration(login, password)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ setShow(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<div className='registration-wrapper'>
|
|
|
<input
|
|
@@ -45,20 +55,11 @@ const Registration = ({onRegistration}) => {
|
|
|
type="password"
|
|
|
/>
|
|
|
|
|
|
- <button
|
|
|
- onClick={() => {
|
|
|
- if(isRegistrationValid()) {
|
|
|
- onRegistration(login, password)
|
|
|
- }
|
|
|
- else {
|
|
|
- setShow(true)
|
|
|
- }
|
|
|
- }}
|
|
|
- // disabled={!isRegistrationValid()}
|
|
|
- className={isRegistrationValid() ? 'button-hover': ''}
|
|
|
- >
|
|
|
- <b>Registration</b>
|
|
|
- </button>
|
|
|
+ <Button
|
|
|
+ name='Registration'
|
|
|
+ isValid={isRegistrationValid()}
|
|
|
+ callback={registrationCallback}
|
|
|
+ />
|
|
|
|
|
|
<nav className='registration-wrapper__link'>
|
|
|
<NavLink to="/login">Login</NavLink>
|