"use strict"; function handleClick() { console.log("Der Button wurde geklickt!"); //const deployMode = (window as { DEPLOY_MODE?: 'docker' | 'k8s' }).DEPLOY_MODE ?? 'k8s'; const deployMode = window.DEPLOY_MODE ?? 'k8s'; const endpoint = deployMode === 'docker' || deployMode === 'local' ? 'http://localhost:8090/iching/api/command' : '/iching/api/command'; console.log(`DEPLOY_MODE=${deployMode}, sende POST an: ${endpoint}`); fetch(endpoint, { 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); });