final: added personHistory

This commit is contained in:
Cron1cle
2025-10-23 03:17:46 +02:00
parent 73d883ae29
commit d40b90de41
7 changed files with 603 additions and 97 deletions

View File

@@ -24,7 +24,7 @@ export type Show = {
concept: string;
startDate?: string;
endDate?: string | null;
logoUri: string;
logoUrl: string;
running: boolean;
};
@@ -58,10 +58,36 @@ export async function getShows(): Promise<Show[]> {
streamingService: s.streamingServices,
concept: s.concept,
running: s.running,
logoUri: s.logoUrl ?? "",
logoUrl: s.logoUrl ?? "",
}));
} catch (error) {
console.error("Fetch error:", error);
throw error;
}
}
export async function getShowById(showId: number): Promise<Show | null> {
const apiKey = process.env.EXPO_PUBLIC_API_KEY;
const url = `${SHOW_API_URL}/${showId}`;
const res = await fetch(url, {
headers: {
"Content-Type": "application/json",
"X-API-Key": apiKey ?? "",
},
});
if (res.status === 404) return null;
if (!res.ok) throw new Error("getShowById failed " + res.status);
const s = (await res.json()) as RawShow;
return {
id: s.showId,
title: s.title,
description: s.description,
genres: s.genre ? s.genre.split(",").map((g) => g.trim()) : [],
thumbnailUri: s.thumbnailUrl,
bannerUri: s.bannerUrl ?? "",
streamingService: s.streamingServices,
concept: s.concept,
running: s.running,
logoUrl: s.logoUrl ?? "",
};
}