♻️ enhan: submit form register when press enter

:%s
This commit is contained in:
lytrankieio123
2021-10-01 09:23:15 +07:00
parent b752b0f7a4
commit 35142990d3

View File

@@ -48,7 +48,7 @@ const FormRegister = ({ onSwitch, isHide }: Props) => {
const onSignupCallBack = (isSuccess: boolean, message?: string) => { const onSignupCallBack = (isSuccess: boolean, message?: string) => {
if (isSuccess) { if (isSuccess) {
showMessageSuccess("Create account successfully. Please verify your email to login.") showMessageSuccess("Create account successfully. Please verify your email to login.", 15000)
} else { } else {
showMessageError(message || LANGUAGE.MESSAGE.ERROR) showMessageError(message || LANGUAGE.MESSAGE.ERROR)
} }
@@ -71,7 +71,7 @@ const FormRegister = ({ onSwitch, isHide }: Props) => {
validationSchema={DisplayingErrorMessagesSchema} validationSchema={DisplayingErrorMessagesSchema}
onSubmit={onSignup} onSubmit={onSignup}
> >
{({ errors, touched }) => ( {({ errors, touched, isValid, submitForm }) => (
<Form className="u-form"> <Form className="u-form">
<div className="body"> <div className="body">
<InputFiledInForm <InputFiledInForm
@@ -93,6 +93,7 @@ const FormRegister = ({ onSwitch, isHide }: Props) => {
? errors.password.toString() ? errors.password.toString()
: '' : ''
} }
onEnter={isValid ? submitForm : undefined}
/> />
<div className={styles.passwordNote}> <div className={styles.passwordNote}>
Must contain 8 characters with at least 1 uppercase and 1 Must contain 8 characters with at least 1 uppercase and 1