aboutsummaryrefslogtreecommitdiff
path: root/pages/api/get-media.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-04-17 16:17:45 +0700
committerFactiven <[email protected]>2023-04-17 16:17:45 +0700
commit9a9e892a1f43a61188cfd08ef1faaf5100d0a41a (patch)
tree005b6b4e5b786139b266847b6548770f9de6bca3 /pages/api/get-media.js
parentUpdate [user].js (diff)
downloadmoopa-9a9e892a1f43a61188cfd08ef1faaf5100d0a41a.tar.xz
moopa-9a9e892a1f43a61188cfd08ef1faaf5100d0a41a.zip
4th fixes
Diffstat (limited to 'pages/api/get-media.js')
-rw-r--r--pages/api/get-media.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/pages/api/get-media.js b/pages/api/get-media.js
deleted file mode 100644
index 8558f63..0000000
--- a/pages/api/get-media.js
+++ /dev/null
@@ -1,76 +0,0 @@
-export default async function handler(req, res) {
- const { username, status } = req.query;
-
- try {
- const response = await fetch("https://graphql.anilist.co/", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- query: `
- query ($username: String, $status: MediaListStatus) {
- MediaListCollection(userName: $username, type: ANIME, status: $status, sort: SCORE_DESC) {
- user {
- id
- name
- about (asHtml: true)
- createdAt
- avatar {
- large
- }
- statistics {
- anime {
- count
- episodesWatched
- meanScore
- minutesWatched
- }
- }
- bannerImage
- mediaListOptions {
- animeList {
- sectionOrder
- }
- }
- }
- lists {
- status
- name
- entries {
- id
- mediaId
- status
- progress
- score
- media {
- id
- status
- title {
- english
- romaji
- }
- episodes
- coverImage {
- large
- }
- }
- }
- }
- }
- }
- `,
- variables: {
- username,
- status,
- },
- }),
- });
-
- const data = await response.json();
- res.status(200).json(data.data.MediaListCollection);
- } catch (error) {
- console.error(error);
- res.status(500).json({ message: "Internal server error" });
- }
-}