Setup handleSubmit, handleSetDateTime, and handleReboot modularization with SettingsModal updates
This commit is contained in:
24
components/modales/setttingsModal/handlers/handleReboot.js
Normal file
24
components/modales/setttingsModal/handlers/handleReboot.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const handleReboot = () => {
|
||||
if (
|
||||
window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?")
|
||||
) {
|
||||
// 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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default handleReboot;
|
||||
Reference in New Issue
Block a user