PraxaLing / app /api /me /route.ts
Reubencf's picture
Deploy PraxaLing: component refactor, bug fixes, unified neo-brutal design, Qwen3.5 everywhere
2992997
Raw
History Blame Contribute Delete
753 Bytes
import { NextResponse } from "next/server";
import { getSession } from "@/lib/auth/session";
export async function GET() {
const session = await getSession();
if (!session) return NextResponse.json({ error: "unauthenticated" }, { status: 401 });
return NextResponse.json({
user: {
id: session.hfId,
hfId: session.hfId,
hfUsername: session.hfUsername,
email: session.email,
avatarUrl: session.avatarUrl,
},
profile: session.targetLang
? {
nativeLang: session.nativeLang,
targetLang: session.targetLang,
targetLangs: session.targetLangs ?? [session.targetLang],
level: session.level,
}
: null,
streakCount: session.streakCount ?? 0,
});
}