{"size": 1352, "ext": "js", "max_stars_repo_path": "src/container/Auth/RegisterPageContainer/reducer.js", "max_stars_repo_name": "naiger/Fishlinked", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/container/Auth/RegisterPageContainer/reducer.js", "max_issues_repo_name": "naiger/Fishlinked", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/container/Auth/RegisterPageContainer/reducer.js", "max_forks_repo_name": "naiger/Fishlinked", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.0952380952, "max_line_length": 70, "alphanum_fraction": 0.599852071}
// @flow
const initialState = {
	registerEmail: "",
	registerPW: "",
	confirmPW: "",
	emailValid: true,
	PWValid: true,
	confirmPWValid: true,
	isRegistering: false,
	isRegistered: false,
	registerErrorMessage: "",
};

export default function(state: any = initialState, action: Function) {
	switch(action.type){
		case "SET_EMAIL":{
			return {
				...state,
				registerEmail: action.email,
			};
			break;
		}
		case "SET_PASSWORD":{
			return {
				...state,
				registerPW: action.password,
			};
			break;
		}
		case "SET_CONFIRM_PASSWORD":{
			return {
				...state,
				confirmPW: action.password,
			};
			break;
		}
		case "EMAIL_VALIDATE":{
			return {
				...state,
				emailValid: action.bool,
			};
			break;
		}
		case "PASSWORD_VALIDATE":{
			return {
				...state,
				PWValid: action.bool,
			};
			break;
		}
		case "CONFIRM_PASSWORD_VALIDATE": {
			return {
				...state,
				confirmPWValid: action.bool,
			};
			break;
		}
		case "REGISTER_SUCCESS": {
			return {
				...state,
				isRegistered: true,
				registerErrorMessage: null,
			};
			break;
		}
		case "REGISTER_ERROR": {
			return {
				...state,
				isRegistered: false,
				registerErrorMessage: action.error,
			};
			break;
		}
		case "USER_IS_REGISTERING": {
			return {
				...state,
				isRegistering: action.isRegistering,
			};
			break;
		}
	}
	return state;
}
