// Aktuelles Buch aus Hardcover (über n8n). Tisch, Stapel und Lese-Fenster teilen sich eine Anfrage. export interface CurrentBook { title: string; authors: string[]; image: string | null; progress: number; } // Tisch und Stapel zeigen das Buch beide; so wird es nur einmal geladen let bookRequest: Promise | null = null; export function loadCurrentBook(): Promise { if (!bookRequest) { bookRequest = fetch("/api/n8n/hardcover/currently-reading") .then((res) => (res.ok ? res.json() : null)) .then((data) => { const list = data?.currentlyReading; const first = Array.isArray(list) ? list[0] : list; return first ?? null; }) .catch(() => null); } return bookRequest; }