handleReboot fetch vollständigen Host und dem aktuellen Pfad in SettingsModal.jsx
This commit is contained in:
@@ -52,10 +52,21 @@ function SettingModal({ showModal, onClose }) {
|
|||||||
if (
|
if (
|
||||||
window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?")
|
window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?")
|
||||||
) {
|
) {
|
||||||
fetch(`CPL?${currentPath}&BOOT=1`, {
|
// Get the current path and ensure it ends with ".html"
|
||||||
method: "GET",
|
let currentPath = window.location.pathname;
|
||||||
}).finally(() => {
|
if (!currentPath.endsWith(".html")) {
|
||||||
window.location.href = `/wait`; // auf Client-Seite
|
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
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user