first commit
This commit is contained in:
commit
5d6023a8af
52 files changed
+5830
No files matched your search
@@ -0,0 +1,2 @@
|
||||
import { handlers } from "@/auth"; // Referring to the auth.ts we just created
|
||||
export const { GET, POST } = handlers;
|
||||
@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const { email, password } = await request.json();
|
||||
|
||||
// const user = await prisma.user.findUnique({ where: { email } });
|
||||
// if (user || !(await verifyPassword(password, user.password))) {
|
||||
// return NextResponse.json({ error: "Invalid Credentials" }, { status: 401 });
|
||||
// }
|
||||
|
||||
if (email !== "admin@test.com" || password !== "admin") {
|
||||
return NextResponse.json({ error: "Invalid Credentials" }, { status: 401 });
|
||||
}
|
||||
|
||||
//const token = generateToken(user);
|
||||
|
||||
const response = NextResponse.json({
|
||||
message: "Login Successful",
|
||||
user: { id: "1", name: "admin" }
|
||||
});
|
||||
|
||||
// Set httponly cookie (can't be accessed by JavaScript)
|
||||
//setAuthCookie(response, token);
|
||||
|
||||
return response;
|
||||
}
|
||||
Reference in new issue
Block a user