From 4912a872e0336765cf2e735988a4a972b957f63e Mon Sep 17 00:00:00 2001 From: diced Date: Sat, 4 Mar 2023 17:51:40 -0800 Subject: [PATCH] fix: undef file --- src/pages/api/user/files.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/api/user/files.ts b/src/pages/api/user/files.ts index dac2c08..50bc9f1 100644 --- a/src/pages/api/user/files.ts +++ b/src/pages/api/user/files.ts @@ -49,10 +49,10 @@ async function handler(req: NextApiReq, res: NextApiRes, user: UserExtended) { } else if (req.method === 'PATCH') { if (!req.body.id) return res.badRequest('no file id'); - let image; + let file; if (req.body.favorite !== null) - image = await prisma.file.update({ + file = await prisma.file.update({ where: { id: req.body.id }, data: { favorite: req.body.favorite, @@ -61,7 +61,7 @@ async function handler(req: NextApiReq, res: NextApiRes, user: UserExtended) { // @ts-ignore if (file.password) file.password = true; - return res.json(image); + return res.json(file); } else { if (req.query.count) { const count = await prisma.file.count({