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({