fix: 'upcoming' titles failing to fetch
wasn't returning "Page" from the anilist json response
This commit is contained in:
@@ -30,7 +30,7 @@ export async function fetchPopularTitlesFromAnilist(
|
||||
);
|
||||
break;
|
||||
case "upcoming":
|
||||
data = await stub.nextSeasonPopular(next.season, next.year, limit);
|
||||
data = await stub.nextSeasonPopular(next.season, next.year, page, limit);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown category: ${category}`);
|
||||
|
||||
@@ -127,23 +127,28 @@ export class AnilistDurableObject extends DurableObject {
|
||||
) {
|
||||
return this.handleCachedRequest(
|
||||
`popular:${JSON.stringify({ season, seasonYear, nextSeason, nextYear, limit })}`,
|
||||
async () => {
|
||||
console.log(nextSeason, nextYear, print(BrowsePopularQuery));
|
||||
() => {
|
||||
return this.fetchFromAnilist(BrowsePopularQuery, {
|
||||
season,
|
||||
seasonYear,
|
||||
nextSeason,
|
||||
nextYear,
|
||||
limit,
|
||||
});
|
||||
page,
|
||||
}).then((data) => data?.Page);
|
||||
},
|
||||
24 * 60 * 60 * 1000,
|
||||
DateTime.now().plus({ days: 1 }),
|
||||
);
|
||||
}
|
||||
|
||||
async nextSeasonPopular(nextSeason: any, nextYear: number, limit: number) {
|
||||
async nextSeasonPopular(
|
||||
nextSeason: any,
|
||||
nextYear: number,
|
||||
page: number,
|
||||
limit: number,
|
||||
) {
|
||||
return this.handleCachedRequest(
|
||||
`next_season:${JSON.stringify({ nextSeason, nextYear, limit })}`,
|
||||
`next_season:${JSON.stringify({ nextSeason, nextYear, page, limit })}`,
|
||||
async () => {
|
||||
return this.fetchFromAnilist(NextSeasonPopularQuery, {
|
||||
nextSeason,
|
||||
|
||||
@@ -260,7 +260,8 @@ export const NextSeasonPopularQuery = graphql(
|
||||
$nextYear: Int
|
||||
$limit: Int!
|
||||
) {
|
||||
Page(page: 1, perPage: $limit) {
|
||||
$page: Int!
|
||||
Page(page: $page, perPage: $limit) {
|
||||
media(
|
||||
season: $nextSeason
|
||||
seasonYear: $nextYear
|
||||
|
||||
Reference in New Issue
Block a user