mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
♻️ enhan: submit form register when press enter
:%s
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user