Systemeinstellung Modal bei Übernehmen button geht immer zu CP?{currentPath} URL
This commit is contained in:
@@ -3,6 +3,7 @@ import ReactModal from "react-modal";
|
|||||||
import { ClipLoader } from "react-spinners";
|
import { ClipLoader } from "react-spinners";
|
||||||
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
|
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
import { current } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
// Definiere das App-Element für ReactModal
|
// Definiere das App-Element für ReactModal
|
||||||
ReactModal.setAppElement("#__next");
|
ReactModal.setAppElement("#__next");
|
||||||
@@ -42,13 +43,19 @@ function SettingModal({ showModal, onClose }) {
|
|||||||
// Originalwerte speichern
|
// Originalwerte speichern
|
||||||
const [originalValues, setOriginalValues] = useState({});
|
const [originalValues, setOriginalValues] = useState({});
|
||||||
// Effekt, um Redux-Werte beim Anzeigen des Modals in lokale State-Variablen zu setzen
|
// 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 = () => {
|
const handleReboot = () => {
|
||||||
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?index.html&BOOT=1`, { method: "GET" }).finally(() => {
|
fetch(`CPL?${currentPath}&BOOT=1`, {
|
||||||
window.location.href = `/wait`; //auf Client-Seite
|
method: "GET",
|
||||||
|
}).finally(() => {
|
||||||
|
window.location.href = `/wait`; // auf Client-Seite
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -57,7 +64,7 @@ function SettingModal({ showModal, onClose }) {
|
|||||||
if (
|
if (
|
||||||
window.confirm("Sind Sie sicher, dass Sie die Datenbank leeren möchten?")
|
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)
|
fetch(clearDbUrl)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -108,7 +115,7 @@ function SettingModal({ showModal, onClose }) {
|
|||||||
|
|
||||||
// Falls Änderungen vorhanden sind, sende die neuen Daten
|
// Falls Änderungen vorhanden sind, sende die neuen Daten
|
||||||
if (Object.keys(changes).length > 0) {
|
if (Object.keys(changes).length > 0) {
|
||||||
let url = `CPL?index.html`;
|
let url = `CPL?${currentPath}`;
|
||||||
|
|
||||||
Object.keys(changes).forEach((paramKey) => {
|
Object.keys(changes).forEach((paramKey) => {
|
||||||
url += `&${paramKey}=${encodeURIComponent(changes[paramKey])}`;
|
url += `&${paramKey}=${encodeURIComponent(changes[paramKey])}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user