gh_UserManager/apps/web/app/api/auth/me/route.ts
bermooda-company 54d5891edf user
2026-08-23 23:59:14 +03:30

15 lines
515 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { djangoUrl } from "../proxy";
export async function GET(req: NextRequest) {
const access = req.cookies.get("access_token")?.value;
const upstream = await fetch(djangoUrl("auth/me/"), {
method: "GET",
headers: access
? { Authorization: `Bearer ${access}` }
: { "Content-Type": "application/json" },
});
const data = await upstream.json().catch(() => ({}));
return NextResponse.json(data, { status: upstream.status });
}