This commit is contained in:
2025-12-07 18:38:03 +01:00
parent 5ca2454853
commit 2d0860d66c
23 changed files with 7713 additions and 779 deletions

View File

@@ -0,0 +1,26 @@
import { NextResponse } from 'next/server';
import { getAuthService } from '@/lib/auth';
export async function POST(request: Request) {
try {
const body = await request.json();
const { email, password } = body;
if (!email || !password) {
return NextResponse.json(
{ error: 'Email and password are required' },
{ status: 400 }
);
}
const authService = getAuthService();
const session = await authService.loginWithEmail({ email, password });
return NextResponse.json({ success: true, session });
} catch (error) {
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Login failed' },
{ status: 401 }
);
}
}

View File

@@ -0,0 +1,26 @@
import { NextResponse } from 'next/server';
import { getAuthService } from '@/lib/auth';
export async function POST(request: Request) {
try {
const body = await request.json();
const { email, password, displayName } = body;
if (!email || !password || !displayName) {
return NextResponse.json(
{ error: 'Email, password, and display name are required' },
{ status: 400 }
);
}
const authService = getAuthService();
const session = await authService.signupWithEmail({ email, password, displayName });
return NextResponse.json({ success: true, session });
} catch (error) {
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Signup failed' },
{ status: 400 }
);
}
}