import { NextRequest, NextResponse } from "next/server";
import { getSessionUser } from "@/lib/auth/human-auth";
export async function GET(request: NextRequest) {
try {
const user = await getSessionUser(request);
if (!user) {
return NextResponse.json({ user: null }, { status: 401 });
}
return NextResponse.json({
user: {
id: user.id,
email: user.email,
displayName: user.displayName,
isAdmin: user.isAdmin,
},
});
} catch (error) {
console.error("Auth me error:", error);
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }
);
}
}