Added sideswitch functionality, cleanup, comments

This commit is contained in:
2024-05-28 23:00:32 +02:00
parent 835248a9dc
commit ad6ab2ecab
5 changed files with 60 additions and 9 deletions
+2 -3
View File
@@ -68,7 +68,6 @@ async function initialUpdate() {
// Request monitor refresh for index frontend
async function refreshMonitor() {
const response = await fetch("/admin/refreshMonitor"); // Call API Endpoint /admin/timerStart
const data = await response.json(); // Wait for asyncronous transfer to complete
}
// ######################################################################################################################################################
@@ -160,8 +159,8 @@ async function scoreAlterScore(team, dir) {
}
// Switch sides
async function scoreSwitch() {
const response = await fetch("/admin/scoreSwitch"); // Call API Endpoint /admin/scoreSwitch
async function scoreToggleSideswitch() {
const response = await fetch("/admin/scoreToggleSideswitch");// Call API Endpoint /admin/scoreSwitch
const data = await response.json(); // Wait for asyncronous transfer to complete
updateScoreFrontend(data); // Update admin frontend
}
@@ -27,6 +27,10 @@ socket.on('score', (message) => {
document.getElementById("score").innerHTML = message; // Display score in corresponding html Element
});
socket.on('scoreSideswitch', (message) => {
scoreGetValues(); // Update frontend when sides have been switch (switches team name sides)
});
// ######################################################################################################################################################
// General functions
// ######################################################################################################################################################