From 259332ff18d62a27b32f6c080e06e03589233856 Mon Sep 17 00:00:00 2001 From: Jackson Tran Date: Mon, 19 Aug 2024 15:40:01 -0700 Subject: [PATCH] fix verify find --- server/routes/api/v1/users/verify.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/routes/api/v1/users/verify.js b/server/routes/api/v1/users/verify.js index a44b2c46..53c15354 100644 --- a/server/routes/api/v1/users/verify.js +++ b/server/routes/api/v1/users/verify.js @@ -26,13 +26,13 @@ export default async function (fastify, _opts) { async (request, reply) => { const { emailVerificationToken } = request.body; - let data = await fastify.prisma.user.findMany({ - where: { emailVerificationToken: emailVerificationToken }, + let data = await fastify.prisma.user.findUnique({ + where: { emailVerificationToken }, }); - if (data.length == 0) { + if (!data) { return reply.notFound(); } - const user = new User(data[0]); + const user = new User(data); if (!user.isEmailVerified) { data = await fastify.prisma.user.update({