Working TOC

This commit is contained in:
Adrian Rumpold
2025-04-23 12:11:53 +02:00
parent 54a3aba531
commit 6dcf39dc58
6 changed files with 195 additions and 14 deletions

View File

@@ -1,3 +1,6 @@
import TOC from "../components/TOC";
import { Language } from "./types";
const API_URL = import.meta.env.VITE_API_URL;
async function getArticle(
@@ -20,4 +23,10 @@ async function getArticleIds(celexId: string): Promise<number[]> {
return await response.json();
}
export { getArticle, getArticleIds };
async function getToc(celexId: string, language: Language): Promise<TOC> {
console.debug(`Fetching TOC for CELEX ID ${celexId}`);
const response = await fetch(`${API_URL}/${celexId}/toc/${language}`);
return await response.json();
}
export { getArticle, getArticleIds, getToc };