This commit is contained in:
2025-03-02 13:59:35 +01:00
parent bf5909ba55
commit 200e9bb77b
2 changed files with 30 additions and 29 deletions
+3
View File
@@ -39,3 +39,6 @@ yarn-error.log*
# typescript # typescript
*.tsbuildinfo *.tsbuildinfo
next-env.d.ts next-env.d.ts
# Local Netlify folder
.netlify
+27 -29
View File
@@ -53,41 +53,39 @@ export async function GET(req: NextRequest) {
export async function POST(req: NextRequest) { export async function POST(req: NextRequest) {
const { email, password } = await req.json(); const { email, password } = await req.json();
// if (typeof email !== 'string' || typeof password !== 'string') if (typeof email !== 'string' || typeof password !== 'string')
// return NextResponse.json( return NextResponse.json(
// { {
// message: message:
// "Invalid structure, body requires 'email: string' and 'password: string'", "Invalid structure, body requires 'email: string' and 'password: string'",
// }, },
// { status: 400 } { status: 400 }
// ); );
// const user = await database.users.findOne({ email }); const user = await database.users.findOne({ email });
// if (!user) if (!user)
// return NextResponse.json( return NextResponse.json(
// { {
// message: 'Email does not exist', message: 'Email does not exist',
// }, },
// { status: 401 } { status: 401 }
// ); );
// if (user.password !== password) if (user.password !== password)
// return NextResponse.json( return NextResponse.json(
// { {
// message: 'Invalid password', message: 'Invalid password',
// }, },
// { status: 401 } { status: 401 }
// ); );
// const _id = new ObjectId();
// database.sessions
// .insertOne({ _id, user: user._id.toString() })
// .then((res) => {});
const _id = new ObjectId(); const _id = new ObjectId();
database.sessions
.insertOne({ _id, user: user._id.toString() })
.then((res) => {});
return NextResponse.json( return NextResponse.json(
{ {
message: 'ok', message: 'ok',