diff --git a/src/app/api/guess/dataProvider.ts b/src/app/api/guess/dataProvider.ts index 4367724..416db4f 100644 --- a/src/app/api/guess/dataProvider.ts +++ b/src/app/api/guess/dataProvider.ts @@ -1,11 +1,11 @@ -import type { Match } from "@/types"; +import type { Match, NorwegianPersonItem } from "@/types"; export async function findNorwegianPerson(input: string): Promise { const apiUrl = `https://snl.no/api/v1/search?query=${encodeURIComponent(input)}&limit=5`; const response = await fetch(apiUrl); const data = await response.json(); - function isNorwegianPerson(item: any): boolean { + function isNorwegianPerson(item: NorwegianPersonItem): boolean { // Must be a biography if (item.article_type_id !== 2) return false; diff --git a/src/app/types.ts b/src/app/types.ts index a73742d..94e80bc 100644 --- a/src/app/types.ts +++ b/src/app/types.ts @@ -4,3 +4,15 @@ export interface Match { description: string | undefined; correct: boolean; } + +export interface NorwegianPersonItem { + article_type_id: number; + rank: number; + taxonomy_title?: string; + subject_title?: string; + first_sentences?: string; + snippet?: string; + title?: string; + headword?: string; + article_url_json?: string; +}