diff options
Diffstat (limited to 'pages/api')
| -rw-r--r-- | pages/api/get-media.js | 2 | ||||
| -rw-r--r-- | pages/api/get-user.js | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pages/api/get-media.js b/pages/api/get-media.js index 4c65654..8558f63 100644 --- a/pages/api/get-media.js +++ b/pages/api/get-media.js @@ -1,5 +1,5 @@ export default async function handler(req, res) { - const { username, status } = req.body; + const { username, status } = req.query; try { const response = await fetch("https://graphql.anilist.co/", { diff --git a/pages/api/get-user.js b/pages/api/get-user.js index 36bc974..439d4eb 100644 --- a/pages/api/get-user.js +++ b/pages/api/get-user.js @@ -1,11 +1,11 @@ import clientPromise from "../../lib/mongodb"; -export async function getUser(userName) { +export async function getUser(userId) { const client = await clientPromise; const db = client.db("authbase"); const collection = db.collection("users"); - const user = await collection.findOne({ name: userName }); + const user = await collection.findOne({ id: userId }); if (user && user._id) { user._id = String(user._id); @@ -15,8 +15,8 @@ export async function getUser(userName) { } export default async function handler(req, res) { - const { userName } = req.query; - const user = await getUser(userName); + const { userId } = req.query; + const user = await getUser(userId); res.status(200).json(user); } |