export const API_URL = "https://regwatch-api.nfteam.ovh"; export type ApiDocument = { id: number; title: string; ingredient: string; source: string; type: string; date?: string | null; pdf_url: string; }; export async function getDocuments(): Promise { const res = await fetch(`${API_URL}/documents`); if (!res.ok) throw new Error(`API error: ${res.status}`); return res.json(); } export function openPdf(pdfUrl: string): void { window.open(pdfUrl, "_blank", "noopener,noreferrer"); }