import { useQuery } from "@tanstack/react-query"; import type { ScanLogEntry } from "@launchpad/shared"; async function fetchLogs(): Promise { const res = await fetch("/api/logs"); if (!res.ok) { throw new Error(`Logs konnten nicht geladen werden (HTTP ${res.status})`); } return res.json(); } export function useLogs() { return useQuery({ queryKey: ["logs"], queryFn: fetchLogs, refetchInterval: 5000, }); }