Systemeinstellung Modal bei Übernehmen button geht immer zu CP?{currentPath} URL

This commit is contained in:
ISA
2024-11-07 08:28:16 +01:00
parent a3bc86258c
commit e21b960b38

View File

@@ -3,6 +3,7 @@ import ReactModal from "react-modal";
import { ClipLoader } from "react-spinners";
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
import { useSelector } from "react-redux";
import { current } from "@reduxjs/toolkit";
// Definiere das App-Element für ReactModal
ReactModal.setAppElement("#__next");
@@ -42,13 +43,19 @@ function SettingModal({ showModal, onClose }) {
// Originalwerte speichern
const [originalValues, setOriginalValues] = useState({});
// Effekt, um Redux-Werte beim Anzeigen des Modals in lokale State-Variablen zu setzen
// Initialisiere currentPath für die gesamte Datei
let currentPath = window.location.pathname;
if (!currentPath.endsWith(".html")) {
currentPath += ".html";
}
const handleReboot = () => {
if (
window.confirm("Sind Sie sicher, dass Sie den CPL neu starten möchten?")
) {
fetch(`CPL?index.html&BOOT=1`, { method: "GET" }).finally(() => {
window.location.href = `/wait`; //auf Client-Seite
fetch(`CPL?${currentPath}&BOOT=1`, {
method: "GET",
}).finally(() => {
window.location.href = `/wait`; // auf Client-Seite
});
}
};
@@ -57,7 +64,7 @@ function SettingModal({ showModal, onClose }) {
if (
window.confirm("Sind Sie sicher, dass Sie die Datenbank leeren möchten?")
) {
const clearDbUrl = `CPL?index.html&DEDB=1`;
const clearDbUrl = `CPL?${currentPath}&DEDB=1`;
fetch(clearDbUrl)
.then((response) => {
@@ -108,7 +115,7 @@ function SettingModal({ showModal, onClose }) {
// Falls Änderungen vorhanden sind, sende die neuen Daten
if (Object.keys(changes).length > 0) {
let url = `CPL?index.html`;
let url = `CPL?${currentPath}`;
Object.keys(changes).forEach((paramKey) => {
url += `&${paramKey}=${encodeURIComponent(changes[paramKey])}`;