feat: Redux-Integration für Meldungen, Anzeige von 'v' statt 's' in UI

This commit is contained in:
ISA
2025-06-30 08:59:48 +02:00
parent 2a9bebb4bc
commit 62de915485
19 changed files with 1647 additions and 1104 deletions

View File

@@ -20,7 +20,10 @@ export const fetchLast20MessagesFromWindow = async (): Promise<
document.body.appendChild(script);
});
const raw = (window as any).win_last20Messages;
interface WindowWithLast20Messages extends Window {
win_last20Messages?: unknown;
}
const raw = (window as WindowWithLast20Messages).win_last20Messages;
return raw ? String(raw) : null;
};

View File

@@ -0,0 +1,26 @@
// services/fetchMessagesService.ts
export const fetchMessagesService = async (
fromDate: string,
toDate: string
) => {
const from = new Date(fromDate);
const to = new Date(toDate);
const fy = from.getFullYear();
const fm = String(from.getMonth() + 1).padStart(2, "0");
const fd = String(from.getDate()).padStart(2, "0");
const ty = to.getFullYear();
const tm = String(to.getMonth() + 1).padStart(2, "0");
const td = String(to.getDate()).padStart(2, "0");
const isDev =
typeof window !== "undefined" && window.location.hostname === "localhost";
const url = isDev
? `/api/cpl/getMessagesAPIHandler`
: `/CPL?Service/ae.ACP&MSS1=${fy};${fm};${fd};${ty};${tm};${td};All`;
const res = await fetch(url);
const raw = await res.json();
const data = Array.isArray(raw) ? raw : raw.data;
return data;
};