implemented new model for database, new routes for save. Fixed logout not allowing post requests

This commit is contained in:
2026-03-30 13:22:04 +02:00
parent 5781eef189
commit b808b0017b
12 changed files with 94 additions and 3 deletions
+36 -1
View File
@@ -196,4 +196,39 @@ function updateQueenList() {
count++;
}
}
}
}
async function saveGame() {
await fetch("/save", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
board: board,
mode: mode
})
});
alert("💾 Spiel gespeichert!");
}
async function loadGame() {
const res = await fetch("/load");
const data = await res.json();
board = data.board;
mode = data.mode;
// Buttons richtig setzen
document.getElementById("btnQueens").classList.remove("active");
document.getElementById("btnRooks").classList.remove("active");
if (mode === "queens") {
document.getElementById("btnQueens").classList.add("active");
} else {
document.getElementById("btnRooks").classList.add("active");
}
drawBoard();
}