mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: send code button behavior on enter key press (#1121)
This commit is contained in:
parent
def391cb76
commit
74329a49cc
@ -88,6 +88,25 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
|
|||||||
setErrorResendingCode(false);
|
setErrorResendingCode(false);
|
||||||
}, [emailOld]);
|
}, [emailOld]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const submitForm = (e: KeyboardEvent) => {
|
||||||
|
if (!codeSent && e.key === "Enter") {
|
||||||
|
e.preventDefault();
|
||||||
|
handleSubmit(onSubmit)().then(() => {
|
||||||
|
setResendCodeTimer(30);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!codeSent) {
|
||||||
|
window.addEventListener("keydown", submitForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("keydown", submitForm);
|
||||||
|
};
|
||||||
|
}, [handleSubmit, codeSent]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<form className="space-y-5 py-5 px-5">
|
<form className="space-y-5 py-5 px-5">
|
||||||
|
Loading…
Reference in New Issue
Block a user