mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:23:25 +00:00
feat: fetchSeasonDetails function
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import type { MovieDetails, TvShowDetails } from "tmdb-ts";
|
import type { MovieDetails, SeasonDetails, TvShowDetails } from "tmdb-ts";
|
||||||
|
|
||||||
import { tmdb } from "./util";
|
import { tmdb } from "./util";
|
||||||
|
|
||||||
@@ -22,3 +22,18 @@ export async function fetchMediaDetails(
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function fetchSeasonDetails(
|
||||||
|
id: string,
|
||||||
|
season: number,
|
||||||
|
): Promise<SeasonDetails | undefined> {
|
||||||
|
try {
|
||||||
|
const result = await tmdb.tvSeasons.details(
|
||||||
|
{ tvShowID: parseInt(id, 10), seasonNumber: season },
|
||||||
|
["external_ids"],
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
} catch (ex) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user