From 45e817672c1b1bfe04f47696da9605e96339c505 Mon Sep 17 00:00:00 2001 From: headlesdev Date: Sat, 17 May 2025 15:31:01 +0200 Subject: [PATCH] Update Login to use email --- app/api/user/{login.ts => login}/route.ts | 6 +++--- tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/api/user/{login.ts => login}/route.ts (92%) diff --git a/app/api/user/login.ts/route.ts b/app/api/user/login/route.ts similarity index 92% rename from app/api/user/login.ts/route.ts rename to app/api/user/login/route.ts index 0317998..c47f991 100644 --- a/app/api/user/login.ts/route.ts +++ b/app/api/user/login/route.ts @@ -4,7 +4,7 @@ import jwt from 'jsonwebtoken'; import prisma from "@/app/prisma"; interface Body { - username: string; + email: string; password: string; remember?: boolean; } @@ -13,13 +13,13 @@ export async function POST(request: NextRequest) { try { const body: Body = await request.json(); - if (!body.username || !body.password) { + if (!body.email || !body.password) { return NextResponse.json({ error: "Missing required fields" }, { status: 400 }); } const user = await prisma.user.findUnique({ where: { - username: body.username, + email: body.email, }, }); diff --git a/tsconfig.json b/tsconfig.json index d8b9323..f09e004 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,6 @@ "@/*": ["./*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "app/api/user/login"], "exclude": ["node_modules"] }