mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
console fix
This commit is contained in:
parent
3e329d5bb3
commit
e25dcbcf6a
@ -19,29 +19,33 @@ const ServerConsole = ({ user }) => {
|
||||
logsEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const fetchServerLogs = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const fetchServerLogs = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const response = await serviiApi.fetchLogs(serverName);
|
||||
if (response.return_code === 200) {
|
||||
let logString = response.message;
|
||||
logString = logString.slice(1, -1);
|
||||
logString = logString.replace(/\\n/g, '\n');
|
||||
logString = logString.replace(/\\\"/g, '"');
|
||||
setLogs(logString);
|
||||
} else {
|
||||
setError(`Erreur lors de la récupération des logs: ${response.message}`);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(`Erreur: ${err.message}`);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
try {
|
||||
const response = await serviiApi.fetchLogs(serverName);
|
||||
if (response.return_code === 200) {
|
||||
let logString = response.message;
|
||||
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}`);
|
||||
}
|
||||
};
|
||||
} catch (err) {
|
||||
setError(`Erreur: ${err.message}`);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user