15 lines
475 B
TypeScript
15 lines
475 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getSessionUser } from "@/lib/session";
|
|
import { listTenants } from "@/lib/k8s";
|
|
import { listVisibleTenants } from "@/lib/visibility";
|
|
|
|
export async function GET() {
|
|
const user = await getSessionUser();
|
|
if (!user)
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
|
|
const all = await listTenants();
|
|
const visible = await listVisibleTenants(user, all);
|
|
return NextResponse.json(visible);
|
|
}
|