16 lines
586 B
TypeScript
16 lines
586 B
TypeScript
// app/api/me/route.ts
|
|
import { NextResponse } from "next/server";
|
|
|
|
export async function GET(req: Request) {
|
|
const cookie = req.headers.get("cookie") || "";
|
|
const base = process.env.NEXT_PUBLIC_API_BASE_URL!;
|
|
const url = `${base}/users/me?fields=id,display_name,first_name,last_name,email`;
|
|
|
|
const res = await fetch(url, { headers: { cookie }, cache: "no-store" });
|
|
const body = await res.json().catch(() => ({}));
|
|
|
|
return new NextResponse(JSON.stringify(body), {
|
|
status: res.status,
|
|
headers: { "content-type": "application/json" },
|
|
});
|
|
}
|