Server console send key

This commit is contained in:
AntoninoP 2024-09-06 20:42:33 +02:00
parent 4ec70e510e
commit f52930bce4

View File

@ -65,6 +65,12 @@ const ServerConsole = () => {
}
};
const handleKeyPress = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
handleSendMessage();
}
};
if (loading) {
return <Loading />;
@ -108,6 +114,7 @@ const ServerConsole = () => {
className={styles.chatInput}
value={message}
onChange={(e) => setMessage(e.target.value)}
onKeyPress={handleKeyPress}
placeholder="Écrire un message..."
/>
<button className={styles.sendButton} onClick={handleSendMessage}>