Improved article selector with titles and structure
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import TOC from "../components/TOC/TOC";
|
||||
import { Language } from "./types";
|
||||
import { Division, Language } from "./types";
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL;
|
||||
|
||||
@@ -23,10 +22,13 @@ async function getArticleIds(celexId: string): Promise<number[]> {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async function getToc(celexId: string, language: Language): Promise<TOC> {
|
||||
async function getToc(
|
||||
celexId: string,
|
||||
language: Language
|
||||
): Promise<Division[]> {
|
||||
console.debug(`Fetching TOC for CELEX ID ${celexId}`);
|
||||
const response = await fetch(`${API_URL}/${celexId}/toc/${language}`);
|
||||
return await response.json();
|
||||
return (await response.json()) as Division[];
|
||||
}
|
||||
|
||||
export { getArticle, getArticleIds, getToc };
|
||||
|
||||
Reference in New Issue
Block a user