|
@@ -4,14 +4,18 @@ import { Field, reduxForm } from 'redux-form';
|
|
|
import './registrationForm.scss';
|
|
|
|
|
|
import { customInput } from "../customFields/customInput/customInput";
|
|
|
+import { validationForms } from "../../utils/validationForms";
|
|
|
|
|
|
let RegistrationForm = props => {
|
|
|
- const { handleSubmit, postCheckInSubmit } = props;
|
|
|
+ const { handleSubmit, postCheckInSubmit, message } = props;
|
|
|
|
|
|
const submit = value => {
|
|
|
- //console.log(value);
|
|
|
+ //console.log(value);
|
|
|
postCheckInSubmit(value);
|
|
|
- props.history.push('/login');
|
|
|
+ if(message !== 'User was successfully register'){
|
|
|
+ //console.log(message);
|
|
|
+ props.history.push('/login');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
return (
|
|
@@ -29,6 +33,7 @@ let RegistrationForm = props => {
|
|
|
<Field name="sex" component="input" type="radio" id="female" value="female" hidden/>
|
|
|
<label htmlFor="female">female</label>
|
|
|
</div>
|
|
|
+ <div className="required-field">!Required field</div>
|
|
|
</div>
|
|
|
<div className="form-item">
|
|
|
<Field name="phone" component={customInput} type="phone" id="phone" label="Phone" />
|
|
@@ -50,7 +55,8 @@ let RegistrationForm = props => {
|
|
|
};
|
|
|
|
|
|
RegistrationForm = reduxForm({
|
|
|
- form: 'registration'
|
|
|
+ form: 'registration',
|
|
|
+ validate: validationForms
|
|
|
})(RegistrationForm)
|
|
|
|
|
|
export default RegistrationForm
|