{"size": 761, "ext": "js", "max_stars_repo_path": "app/containers/SignIn/dispatches.js", "max_stars_repo_name": "esauri/venu", "max_stars_repo_stars_event_min_datetime": "2017-02-13T13:14:29.000Z", "max_stars_repo_stars_event_max_datetime": "2017-02-13T13:14:29.000Z", "max_issues_repo_path": "app/containers/SignIn/dispatches.js", "max_issues_repo_name": "esauri/venu", "max_issues_repo_issues_event_min_datetime": "2017-02-10T02:45:06.000Z", "max_issues_repo_issues_event_max_datetime": "2017-05-15T03:51:45.000Z", "max_forks_repo_path": "app/containers/SignIn/dispatches.js", "max_forks_repo_name": "esauri/venu", "max_forks_repo_forks_event_min_datetime": "2017-02-10T01:27:44.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-11T21:07:40.000Z"}
{"max_stars_count": 1, "max_issues_count": 62, "max_forks_count": 3, "avg_line_length": 22.3823529412, "max_line_length": 58, "alphanum_fraction": 0.7306176084}
import isEmail from 'validator/lib/isEmail';

// Actions
import {
  changeEmail,
  changePassword,
} from './actions';

/**
 * dispatchChangeEmail
 * dispatches function that changes and validates email
 * @param {Function} dispatch
 * @param {Object} event
 */
export function dispatchChangeEmail(dispatch, event) {
  const email = event.target.value;
  const valid = isEmail(email);

  dispatch(changeEmail(email, valid));
}

/**
 * dispatchChangePassword
 * dispatches function that changes and validates password
 * @param {Function} dispatch
 * @param {Object} event
 */
export function dispatchChangePassword(dispatch, event) {
  const password = event.target.value;
  const valid = (password.length >= 6);

  dispatch(changePassword(password, valid));
}
