ChatGPT-Next-Web/app/api/auth/check/route.ts
2025-06-26 00:47:54 +07:00

22 lines
561 B
TypeScript

// /app/api/auth/check/route.ts
import { NextRequest } from "next/server";
import { checkAuth } from "../../supabase";
export async function GET(req: NextRequest) {
const user = await checkAuth(req);
console.log("[Auth] user ", user);
if (!user) {
return new Response(JSON.stringify({ authenticated: false }), {
status: 401,
headers: { "Content-Type": "application/json" },
});
}
return new Response(JSON.stringify({ authenticated: true, user }), {
status: 200,
headers: { "Content-Type": "application/json" },
});
}