// components/modales/settingsModal/handlers/handleReboot.ts const handleReboot = async (newIp: string | null = null): Promise => { const showWaitPage = () => { const waitHTML = ` Bitte warten...

Bitte warten, CPL wird neu gestartet...

`; document.documentElement.innerHTML = waitHTML; let progress = 0; const progressBar = document.getElementById("progress-bar"); if (progressBar) { const interval = setInterval(() => { progress += 1; progressBar.style.width = progress + "%"; if (progress >= 100) { clearInterval(interval); } }, 300); } else { console.error("Progress-Bar-Element nicht gefunden."); } }; if (window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?")) { showWaitPage(); const baseRedirectURL = newIp ? `https://${newIp}` : window.location.origin; const redirectPath = process.env.NODE_ENV === "production" ? "/dashboard.html" : "/dashboard"; setTimeout(() => { window.location.href = `${baseRedirectURL}${redirectPath}`; }, 33000); const url = `${window.location.origin}/CPL?wait2reboot.html&BOOT=1`; console.log(url); fetch(url, { method: "GET" }) .then(() => { console.log("Neustart-Anfrage erfolgreich gesendet."); }) .catch((error) => { console.error("Fehler beim Senden der Neustartanfrage:", error); }); } }; export default handleReboot;