17 lines
460 B
TypeScript
17 lines
460 B
TypeScript
|
|
import { auth } from "@/app/(auth)/auth";
|
||
|
|
import { ChatbotError } from "@/lib/errors";
|
||
|
|
import { getQuotaSummary } from "@/lib/subscription/service";
|
||
|
|
|
||
|
|
export async function GET() {
|
||
|
|
const session = await auth();
|
||
|
|
if (!session?.user) {
|
||
|
|
return new ChatbotError("unauthorized:chat").toResponse();
|
||
|
|
}
|
||
|
|
const summary = await getQuotaSummary(session.user.id);
|
||
|
|
return Response.json(summary, {
|
||
|
|
headers: {
|
||
|
|
"Cache-Control": "no-store",
|
||
|
|
},
|
||
|
|
});
|
||
|
|
}
|