Expand the calculator with a multi-step wizard flow, admin dashboard with quote tracking, login/auth system, distance API integration, and history page. Add new UI components (dialog, progress, select, slider, switch), update pricing logic, and improve the overall design with new assets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
767 B
TypeScript
26 lines
767 B
TypeScript
import { NextRequest, NextResponse } from "next/server"
|
|
import { login } from "@/lib/auth"
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const { email, password } = await request.json()
|
|
|
|
if (!email || !password) {
|
|
return NextResponse.json({ error: "Email og adgangskode er påkrævet" }, { status: 400 })
|
|
}
|
|
|
|
const result = await login(email, password)
|
|
|
|
if (!result.success) {
|
|
return NextResponse.json({ error: result.error }, { status: 401 })
|
|
}
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
user: { name: result.user.name, email: result.user.email },
|
|
})
|
|
} catch (error) {
|
|
console.error("Login error:", error)
|
|
return NextResponse.json({ error: "Der opstod en fejl" }, { status: 500 })
|
|
}
|
|
}
|