ignorer touch si champs vide

This commit is contained in:
C. Fuhrman 2025-02-27 23:43:58 -05:00
parent 5b41f24404
commit b1fc8e843b
2 changed files with 5 additions and 5 deletions

View file

@ -112,7 +112,7 @@ const JoinRoom: React.FC = () => {
}; };
const handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => { const handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') { if (e.key === 'Enter' && username && roomName) {
handleSocket(); handleSocket();
} }
}; };

View file

@ -36,8 +36,8 @@ const Login: React.FC = () => {
}; };
const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => { const handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') { if (e.key === 'Enter' && email && password) {
login(); login();
} }
}; };
@ -55,7 +55,7 @@ const Login: React.FC = () => {
placeholder="Adresse courriel" placeholder="Adresse courriel"
sx={{ marginBottom: '1rem' }} sx={{ marginBottom: '1rem' }}
fullWidth={true} fullWidth={true}
onKeyDown={handleKeyPress} // Add this line as well onKeyDown={handleReturnKey} // Add this line as well
/> />
<TextField <TextField
@ -67,7 +67,7 @@ const Login: React.FC = () => {
placeholder="Mot de passe" placeholder="Mot de passe"
sx={{ marginBottom: '1rem' }} sx={{ marginBottom: '1rem' }}
fullWidth={true} fullWidth={true}
onKeyDown={handleKeyPress} // Add this line as well onKeyDown={handleReturnKey} // Add this line as well
/> />
<LoadingButton <LoadingButton