fix: 'upcoming season' popular titles not returning
This commit is contained in:
@@ -31,22 +31,13 @@ export async function fetchPopularTitlesFromAnilist(
|
|||||||
mapTitle(title),
|
mapTitle(title),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!data.nextSeason?.media?.[0]?.nextAiringEpisode) {
|
const nextSeasonData = data.nextSeason?.media?.map((title: any) =>
|
||||||
return {
|
mapTitle(title),
|
||||||
trending: trendingTitles,
|
|
||||||
popular: popularSeasonTitles,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextSeasonData = await stub.nextSeasonPopular(
|
|
||||||
nextSeason,
|
|
||||||
nextYear,
|
|
||||||
limit,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
trending: trendingTitles,
|
trending: trendingTitles,
|
||||||
popular: popularSeasonTitles,
|
popular: popularSeasonTitles,
|
||||||
upcoming: nextSeasonData?.Page?.media?.map((title: any) => mapTitle(title)),
|
upcoming: nextSeasonData,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,18 +225,15 @@ export const BrowsePopularQuery = graphql(
|
|||||||
...HomeTitle
|
...HomeTitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextSeason: Page(page: 1, perPage: 1) {
|
nextSeason: Page(page: 1, perPage: $limit) {
|
||||||
media(
|
media(
|
||||||
season: $nextSeason
|
season: $nextSeason
|
||||||
seasonYear: $nextYear
|
seasonYear: $nextYear
|
||||||
sort: START_DATE_DESC
|
sort: POPULARITY_DESC
|
||||||
type: ANIME
|
type: ANIME
|
||||||
isAdult: false
|
isAdult: false
|
||||||
) {
|
) {
|
||||||
nextAiringEpisode {
|
...HomeTitle
|
||||||
airingAt
|
|
||||||
timeUntilAiring
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user