import { NextRequest, NextResponse } from 'next/server' export async function POST(request: NextRequest) { try { // Get the request body const body = await request.json() // Make request to backend auth endpoint without requiring existing auth const baseUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL const url = `${baseUrl}/api/v1/auth/login` const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }) const data = await response.json() if (!response.ok) { return NextResponse.json(data, { status: response.status }) } return NextResponse.json(data) } catch (error) { console.error('Error in auth login:', error) return NextResponse.json( { error: 'Failed to process login' }, { status: 500 } ) } }