feat(tdr): Alert nach TDR-Aktivierung/Deaktivierung + automatischer Seitenreload für sichtbare Statusänderung

This commit is contained in:
ISA
2025-05-02 08:51:57 +02:00
parent 7834bbca39
commit 668cdba80b
5 changed files with 29 additions and 4 deletions

View File

@@ -120,6 +120,14 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
const isDev = window.location.hostname === "localhost";
const slotParam = `KTX${slot}=${newState ? 1 : 0}`;
const reloadAfterConfirm = () => {
const msg = newState
? "✅ TDR wurde aktiviert."
: "⚠️ TDR wurde deaktiviert.";
alert(msg);
location.reload();
};
if (isDev) {
const updates = [{ key: "win_tdrActive", slot, value: newState ? 1 : 0 }];
@@ -131,6 +139,7 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
.then((res) => res.json())
.then(() => {
console.log("TDR-Aktiv-Status gespeichert.");
reloadAfterConfirm();
})
.catch((err) => {
console.error("Fehler beim Speichern von TDR aktiv:", err);
@@ -141,6 +150,7 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
.then((res) => {
if (!res.ok) throw new Error("TDR-Befehl fehlgeschlagen");
console.log("TDR aktiviert/deaktiviert:", res.status);
reloadAfterConfirm();
})
.catch((err) => {
console.error("Fehler beim TDR-Befehl:", err);