From 8a4ac51cfaf26327b9da248aea69fc6fa63495a3 Mon Sep 17 00:00:00 2001 From: Vladik Date: Tue, 5 Nov 2024 15:24:49 +0200 Subject: [PATCH] refactor index.html --- src/main/resources/static/index.html | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 1bfd941..68e55ed 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -34,10 +34,9 @@

Subscribe to topic


Log Text

- + + @@ -140,7 +139,7 @@

Log Text

function refreshTokenAndReconnect() { - updateAccessToken().then(newAccessToken => { + updateAccessToken().then(() => { if (stompClient) { stompClient.disconnect(() => { console.log('Disconnected from WebSocket'); @@ -201,26 +200,24 @@

Log Text

if (topicId.trim() === '') { console.log('topicId is empty'); stompClient.subscribe(subToTopicDest, function (messages) { - let parseMessage = JSON.parse(messages.body); + JSON.parse(messages.body); }); } else { stompClient.subscribe(subToTopicDest + topicId, function (messages) { - let parseMessage = JSON.parse(messages.body); + JSON.parse(messages.body); }); } } function addToLog(destination, object) { - let logtextElement = document.getElementById('logtext'); - - let now = new Date(); - let formattedDateTime = now.toLocaleString(); + let logTextElement = document.getElementById('logText'); + let formattedDateTimeNow = new Date().toLocaleString(); - logtextElement.append(formattedDateTime + ' ' + destination + '\n'); - logtextElement.append('\n' + JSON.stringify(object, null, 2) + '\n'); - logtextElement.append('=================================================================== \n'); + logTextElement.append(formattedDateTimeNow + ' ' + destination + '\n'); + logTextElement.append('\n' + JSON.stringify(object, null, 2) + '\n'); + logTextElement.append('=================================================================== \n'); - logtextElement.scrollTop = logtextElement.scrollHeight; + logTextElement.scrollTop = logTextElement.scrollHeight; }