feat: create routes to load popular titles

This commit is contained in:
2024-10-27 13:59:49 -04:00
parent 99963083f0
commit 592cc08853
13 changed files with 554 additions and 21 deletions

View File

@@ -2,28 +2,27 @@ import { graphql } from "gql.tada";
import { GraphQLClient } from "graphql-request";
import { sleep } from "~/libs/sleep";
import { HomeTitleFragment } from "~/types/title/homeTitle";
const SearchQuery = graphql(`
query Search($query: String!, $page: Int!, $limit: Int!) {
Page(page: $page, perPage: $limit) {
media(search: $query, type: ANIME, sort: [POPULARITY_DESC, SCORE_DESC]) {
id
title {
userPreferred
english
const SearchQuery = graphql(
`
query Search($query: String!, $page: Int!, $limit: Int!) {
Page(page: $page, perPage: $limit) {
media(
search: $query
type: ANIME
sort: [POPULARITY_DESC, SCORE_DESC]
) {
...HomeTitle
}
coverImage {
extraLarge
large
medium
pageInfo {
hasNextPage
}
}
pageInfo {
hasNextPage
}
}
}
`);
`,
[HomeTitleFragment],
);
export async function fetchSearchResultsFromAnilist(
query: string,