console fix

This commit is contained in:
AntoninoP 2024-08-18 18:55:22 +02:00
parent 3e329d5bb3
commit e25dcbcf6a

View File

@ -19,7 +19,6 @@ const ServerConsole = ({ user }) => {
logsEndRef.current?.scrollIntoView({ behavior: "smooth" });
};
useEffect(() => {
const fetchServerLogs = async () => {
setLoading(true);
setError(null);
@ -31,6 +30,10 @@ const ServerConsole = ({ user }) => {
logString = logString.slice(1, -1);
logString = logString.replace(/\\n/g, '\n');
logString = logString.replace(/\\\"/g, '"');
logString = logString.replace(/, ?/g, '');
logString = logString.replace(/"{2,}/g, '');
logString = logString.replace(/'{2,}/g, '');
logString = logString.trim();
setLogs(logString);
} else {
setError(`Erreur lors de la récupération des logs: ${response.message}`);
@ -42,6 +45,7 @@ const ServerConsole = ({ user }) => {
}
};
useEffect(() => {
fetchServerLogs();
}, [serverName]);
@ -53,6 +57,7 @@ const ServerConsole = ({ user }) => {
if (message.trim()) {
console.log(`Message envoyé: ${message}`);
setMessage('');
fetchServerLogs();
}
};
@ -81,7 +86,6 @@ const ServerConsole = ({ user }) => {
</pre>
<div ref={logsEndRef} />
</div>
{}
<div className={styles.chatInputContainer}>
<input
type="text"