From 7ca9656e605c60acd05dae4439c4a264b031a394 Mon Sep 17 00:00:00 2001 From: ISA Date: Sat, 9 Nov 2024 12:07:46 +0100 Subject: [PATCH] =?UTF-8?q?handleReboot=20=20fetch=20vollst=C3=A4ndigen=20?= =?UTF-8?q?Host=20und=20dem=20aktuellen=20Pfad=20in=20SettingsModal.jsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modales/SettingsModal.jsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/components/modales/SettingsModal.jsx b/components/modales/SettingsModal.jsx index 6cc73a0..1f73ccd 100644 --- a/components/modales/SettingsModal.jsx +++ b/components/modales/SettingsModal.jsx @@ -52,10 +52,21 @@ function SettingModal({ showModal, onClose }) { if ( window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?") ) { - fetch(`CPL?${currentPath}&BOOT=1`, { - method: "GET", - }).finally(() => { - window.location.href = `/wait`; // auf Client-Seite + // Get the current path and ensure it ends with ".html" + let currentPath = window.location.pathname; + if (!currentPath.endsWith(".html")) { + currentPath += ".html"; + } + + // Full URL with host, current path, and reboot command + const url = `${window.location.origin}/CPL?${currentPath}&BOOT=1`; + + // Log the full URL to the console for debugging + console.log(url); + + // Send the reboot command to the server using fetch and GET method + fetch(url, { method: "GET" }).finally(() => { + window.location.href = `/wait`; // Redirect to wait page on client side }); } };