fix: Firmware-Update-Button stabilisiert und Flackern entfernt

- useAdminAuth aus KueEinstellung entfernt und einmalig in SettingsModalWrapper ausgelagert
- isAdminLoggedIn als Prop übergeben, um ständige Aktualisierungen zu vermeiden
- Button wird jetzt stabil angezeigt ohne console-Logs oder Intervall-Aufrufe
This commit is contained in:
ISA
2025-07-02 12:03:02 +02:00
parent 1dfa1cc1ba
commit a9f6484fb0
14 changed files with 328 additions and 59 deletions

View File

@@ -3,17 +3,25 @@ import type { NextApiRequest, NextApiResponse } from "next";
import fs from "fs";
import path from "path";
export default function handler(req: NextApiRequest, res: NextApiResponse) {
// Hilfsfunktion für künstliche Verzögerung
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const filePath = path.join(
process.cwd(),
"mocks/device-cgi-simulator/firmwareUpdate/singleModuleUpdateResponse.json"
);
try {
// ⏱️ 10 Sekunden warten
await delay(25000); // 5 Minuten simulieren (300.000 ms)
const fileContents = fs.readFileSync(filePath, "utf-8");
const responseData = JSON.parse(fileContents);
// Optional: slot aus query übernehmen
const slot = req.query.slot ?? "X";
responseData.message = `Update erfolgreich gestartet für Slot ${slot}`;