Working initial version

This commit is contained in:
Adrian Rumpold
2025-04-23 11:30:03 +02:00
commit 54a3aba531
34 changed files with 5583 additions and 0 deletions

23
frontend/src/lib/api.ts Normal file
View File

@@ -0,0 +1,23 @@
const API_URL = import.meta.env.VITE_API_URL;
async function getArticle(
celexId: string,
article: number,
language: string
): Promise<string> {
console.debug(
`Fetching article ${article} for CELEX ID ${celexId} in ${language} language`
);
const response = await fetch(
`${API_URL}/${celexId}/articles/${article}/${language}`
);
return await response.text();
}
async function getArticleIds(celexId: string): Promise<number[]> {
console.debug(`Fetching article list for CELEX ID ${celexId}`);
const response = await fetch(`${API_URL}/${celexId}/articles`);
return await response.json();
}
export { getArticle, getArticleIds };