From b1fc8e843be1d1aa4eb7438831789c805e95f029 Mon Sep 17 00:00:00 2001 From: "C. Fuhrman" Date: Thu, 27 Feb 2025 23:43:58 -0500 Subject: [PATCH] ignorer touch si champs vide --- client/src/pages/Student/JoinRoom/JoinRoom.tsx | 2 +- client/src/pages/Teacher/Login/Login.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/pages/Student/JoinRoom/JoinRoom.tsx b/client/src/pages/Student/JoinRoom/JoinRoom.tsx index 57ecc22..c458d61 100644 --- a/client/src/pages/Student/JoinRoom/JoinRoom.tsx +++ b/client/src/pages/Student/JoinRoom/JoinRoom.tsx @@ -112,7 +112,7 @@ const JoinRoom: React.FC = () => { }; const handleReturnKey = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' && username && roomName) { handleSocket(); } }; diff --git a/client/src/pages/Teacher/Login/Login.tsx b/client/src/pages/Teacher/Login/Login.tsx index c96f3b8..f305101 100644 --- a/client/src/pages/Teacher/Login/Login.tsx +++ b/client/src/pages/Teacher/Login/Login.tsx @@ -36,8 +36,8 @@ const Login: React.FC = () => { }; - const handleKeyPress = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { + const handleReturnKey = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && email && password) { login(); } }; @@ -55,7 +55,7 @@ const Login: React.FC = () => { placeholder="Adresse courriel" sx={{ marginBottom: '1rem' }} fullWidth={true} - onKeyDown={handleKeyPress} // Add this line as well + onKeyDown={handleReturnKey} // Add this line as well /> { placeholder="Mot de passe" sx={{ marginBottom: '1rem' }} fullWidth={true} - onKeyDown={handleKeyPress} // Add this line as well + onKeyDown={handleReturnKey} // Add this line as well />