fixed error from braces

This commit is contained in:
ishak jmilou.ishak
2024-12-18 12:42:15 +01:00
parent 29cfa86b5f
commit ddeeb379cf

View File

@@ -1,5 +1,5 @@
// Selecteer alle knoppen en voeg een event listener toe aan elke knop // Selecteer alle knoppen en voeg een event listener toe aan elke knop
document.querySelectorAll(".btn").forEach(button => { document.querySelectorAll(".btn").forEach((button) => {
button.addEventListener("click", function (event) { button.addEventListener("click", function (event) {
event.preventDefault(); // voorkomt pagina-verversing event.preventDefault(); // voorkomt pagina-verversing
@@ -9,15 +9,15 @@ document.querySelectorAll(".btn").forEach(button => {
fetch("/move", { fetch("/move", {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json",
}, },
body: JSON.stringify({ direction: direction }) body: JSON.stringify({ direction: direction }),
}) })
.then(response => response.json()) .then((response) => response.json())
.then(data => { .then((data) => {
console.log("Success:", data); console.log("Success:", data);
}) })
.catch(error => { .catch((error) => {
console.error("Error:", error); console.error("Error:", error);
}); });
}); });
@@ -31,7 +31,7 @@ document.querySelectorAll(".btn").forEach(button => {
} catch (error) { } catch (error) {
console.error("Error:", error); console.error("Error:", error);
} }
}
// Parse the data and show it on the website // Parse the data and show it on the website
async function parseData() { async function parseData() {