mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
fix tmdb 404 request
This commit is contained in:
parent
4712d8fc5d
commit
5fbe5d1ff5
1 changed files with 6 additions and 3 deletions
|
@ -49,7 +49,7 @@ function Button(props: {
|
||||||
function useSeasons(mediaId: string, isLastEpisode: boolean = false) {
|
function useSeasons(mediaId: string, isLastEpisode: boolean = false) {
|
||||||
const state = useAsync(async () => {
|
const state = useAsync(async () => {
|
||||||
if (isLastEpisode) {
|
if (isLastEpisode) {
|
||||||
const data = await getMetaFromId(MWMediaType.SERIES, mediaId ?? "");
|
const data = await getMetaFromId(MWMediaType.SERIES, mediaId);
|
||||||
if (data?.meta.type !== MWMediaType.SERIES) return null;
|
if (data?.meta.type !== MWMediaType.SERIES) return null;
|
||||||
return data.meta.seasons;
|
return data.meta.seasons;
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,10 @@ function useNextSeasonEpisode(
|
||||||
) {
|
) {
|
||||||
const state = useAsync(async () => {
|
const state = useAsync(async () => {
|
||||||
if (nextSeason) {
|
if (nextSeason) {
|
||||||
|
if (!mediaId) return;
|
||||||
const data = await getMetaFromId(
|
const data = await getMetaFromId(
|
||||||
MWMediaType.SERIES,
|
MWMediaType.SERIES,
|
||||||
mediaId ?? "",
|
mediaId,
|
||||||
nextSeason?.id,
|
nextSeason?.id,
|
||||||
);
|
);
|
||||||
if (data?.meta.type !== MWMediaType.SERIES) return null;
|
if (data?.meta.type !== MWMediaType.SERIES) return null;
|
||||||
|
@ -106,7 +107,9 @@ export function NextEpisodeButton(props: {
|
||||||
const enableAutoplay = usePreferencesStore((s) => s.enableAutoplay);
|
const enableAutoplay = usePreferencesStore((s) => s.enableAutoplay);
|
||||||
|
|
||||||
const isLastEpisode =
|
const isLastEpisode =
|
||||||
meta?.episode?.number === meta?.episodes?.at(-1)?.number;
|
!meta?.episode?.number || !meta?.episodes?.at(-1)?.number
|
||||||
|
? false
|
||||||
|
: meta.episode.number === meta.episodes.at(-1)!.number;
|
||||||
|
|
||||||
const seasons = useSeasons(meta?.tmdbId ?? "", isLastEpisode);
|
const seasons = useSeasons(meta?.tmdbId ?? "", isLastEpisode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue