mirror of
https://github.com/coaidev/coai.git
synced 2025-05-20 13:30:13 +09:00
feat: support the use of enter to submit on the login screen
This commit is contained in:
parent
9916b45bc3
commit
15b7e204e1
@ -141,6 +141,16 @@ function Login() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// listen to enter key and auto submit
|
||||||
|
const listener = async (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Enter") await onSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("keydown", listener);
|
||||||
|
return () => document.removeEventListener("keydown", listener);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`auth-container`}>
|
<div className={`auth-container`}>
|
||||||
<img className={`logo`} src={appLogo} alt="" />
|
<img className={`logo`} src={appLogo} alt="" />
|
||||||
|
Loading…
Reference in New Issue
Block a user