Advertisement
Guest User

Untitled

a guest
May 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function validate(values) {
  2. const errors = {};
  3.  
  4. if (!values.username) errors.username = 'Ingresa un nombre de usuario';
  5.  
  6. if (!values.email) errors.email = 'Ingresa tu correo';
  7.  
  8. if (!values.password) errors.password = 'Ingresa una contraseña';
  9.  
  10. if (!values.repeatPassword) {
  11. errors.repeatPassword = 'Ingresa una contraseña';
  12. } else if (values.repeatPassword !== values.password) {
  13. errors.repeatPassword = 'Las contraseñas no coinciden';
  14. }
  15.  
  16. // If errors is empty, the form is fine to submit
  17. // If errors has any properties, redux form assumes form is invalid
  18. return errors;
  19. }
  20.  
  21. export default reduxForm({
  22. validate,
  23. form: 'UserSignup',
  24. })(SignupForm);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement