import { NextRequest, NextResponse } from 'next/server'; import { withLogging } from '@/lib/utils/api-logger'; interface ClientErrorReport { message: string; stack?: string; componentStack?: string; name?: string; url: string; userAgent: string; timestamp: string; type?: 'error' | 'unhandledrejection'; filename?: string; lineno?: number; colno?: number; } export const POST = withLogging(async (request: NextRequest) => { const errorReport: ClientErrorReport = await request.json(); // The withLogging wrapper will automatically log this with the error details // We can return success to acknowledge receipt return NextResponse.json( { success: true, message: 'Client error logged successfully', timestamp: new Date().toISOString(), }, { status: 200 } ); }, 'logClientError');