iching-broker-level2/frontend/event.ts
Christopher Hase 1ddfc8c769
All checks were successful
ci / build (push) Successful in 1m9s
add http-server part 9.1
2025-04-15 16:28:48 +02:00

13 lines
449 B
TypeScript

function handleClick(): void {
console.log("Der Button wurde geklickt!");
fetch("/iching/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("HTTP-Server says:", text))
.catch(error => console.error("HTTP-Server - Error:", error));
}
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("myButton");
button?.addEventListener("click", handleClick);
});