aboutsummaryrefslogtreecommitdiff
path: root/lib/AniList.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AniList.js')
-rw-r--r--lib/AniList.js54
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/AniList.js b/lib/AniList.js
deleted file mode 100644
index f602dad..0000000
--- a/lib/AniList.js
+++ /dev/null
@@ -1,54 +0,0 @@
-export async function aniListData({ sort, page = 1 }) {
- const resAnilist = await fetch(`https://graphql.anilist.co`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- query: `
- query (
- $id: Int
- $page: Int
- $perPage: Int
- $search: String
- $sort: [MediaSort]
- ) {
- Page(page: $page, perPage: $perPage) {
- pageInfo {
- total
- currentPage
- lastPage
- hasNextPage
- perPage
- }
- media(id: $id, search: $search, sort: $sort type: ANIME) {
- id
- idMal
- title {
- romaji
- english
- }
- coverImage {
- extraLarge
- }
- description
- }
- }
- }
- `,
- variables: {
- page: page,
- perPage: 15,
- sort,
- },
- }),
- });
- const anilistData = await resAnilist.json();
- const data = anilistData.data.Page.media;
- // console.log(resAnilist);
- return {
- props: {
- data,
- },
- };
-}