opentriage-api / src /app /api /user /me /route.ts
KrishnaCosmic's picture
Add missing API endpoints for contributor, messaging, and RAG
0879782
raw
history blame contribute delete
711 Bytes
import { NextRequest, NextResponse } from "next/server";
import { getCurrentUser } from "@/lib/auth";
export async function GET(request: NextRequest) {
try {
const user = await getCurrentUser(request);
if (!user) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// Return user details. In a real app we might fetch full profile from DB here too,
// but getCurrentUser usually returns the basic valid session user.
return NextResponse.json(user);
} catch (error) {
console.error("GET /api/user/me error:", error);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
}