// app/api/auth/me/route.ts import { cookies } from 'next/headers'; import { NextRequest, NextResponse } from 'next/server'; export async function GET(request: NextRequest) { try { const cookieStore = await cookies(); const token = cookieStore.get('auth_token')?.value; if (!token) { return NextResponse.json( { message: 'Not authenticated' }, { status: 401 } ); } const { searchParams } = new URL(request.url); const userId = searchParams.get('userId'); const response = await fetch( `https://byteriot-candidateexplorer.hf.space/CandidateExplorer/file/user/${userId}`, { headers: { Authorization: `Bearer ${token}` }, } ); if (!response.ok) { return NextResponse.json( { message: 'Invalid token' }, { status: 401 } ); } const userData = await response.json(); return NextResponse.json(userData.files, { status: 200 }); } catch (error) { console.error('Get list upload error:', error); return NextResponse.json( { message: 'Failed to get list upload' }, { status: 500 } ); } }