feat(web): route season and episode release decks

This commit is contained in:
Miguel Palhas
2026-08-23 20:44:28 +01:00
parent 06a68372e6
commit cf36a4302c
3 changed files with 101 additions and 2 deletions
+12
View File
@@ -22,7 +22,9 @@ export interface ApiSeries {
export interface ApiEpisode {
id: number;
series_id: number;
season_id: number;
season_number: number;
number: number;
title: string;
air_date: string | null;
@@ -54,6 +56,16 @@ export async function fetchSeries(seriesId: number): Promise<ApiSeries | null> {
}
}
/** One episode by row id — the `/episodes/{id}/releases` deep link's lookup. */
export async function fetchEpisode(episodeId: number): Promise<ApiEpisode | null> {
try {
const response = await fetch(`/api/episodes/${episodeId}`);
return response.ok ? ((await response.json()) as ApiEpisode) : null;
} catch {
return null;
}
}
export async function fetchSeasons(seriesId: number): Promise<SeasonsOutcome> {
try {
const response = await fetch(`/api/series/${seriesId}/seasons`);