Files
regwatch-frontend/src/services/theapi.ts
T
Mouigni 0be0d1fb58
Build & Deploy / build (push) Successful in 20s
Fix : URL API production
2026-08-15 15:35:03 +02:00

21 lines
544 B
TypeScript

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<ApiDocument[]> {
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");
}