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:
@@ -23,6 +23,10 @@ import { getReferenceCurveBySlotThunk } from "@/redux/thunks/getReferenceCurveBy
|
||||
import { getAllTDRReferenceChartThunk } from "@/redux/thunks/getAllTDRReferenceChartThunk";
|
||||
import { getTDRChartDataByIdThunk } from "@/redux/thunks/getTDRChartDataByIdThunk";
|
||||
import { getLoopChartDataThunk } from "@/redux/thunks/getLoopChartDataThunk";
|
||||
import Modal from "react-modal";
|
||||
if (typeof window !== "undefined") {
|
||||
Modal.setAppElement("#__next"); // oder "#root", je nach App-Struktur
|
||||
}
|
||||
|
||||
import "@/styles/globals.css";
|
||||
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user