import { PageHeader } from "@/components/dashboard/page-header"; import { CreateApiButton } from "./create-api-button"; import { Separator } from "@/components/ui/separator"; // import { getTenantId } from "@/lib/auth"; // import { and, db, eq, isNull, schema, sql } from "@/lib/db"; import { Search } from "lucide-react"; import Link from "next/link"; import { redirect } from "next/navigation"; import { ApiList, ApiWithKeys } from "./client"; export const dynamic = "force-dynamic"; export const runtime = "edge"; export default async function ApisOverviewPage() { // const tenantId = getTenantId(); // const workspace = await db.query.workspaces.findFirst({ // where: (table, { and, eq, isNull }) => // and(eq(table.tenantId, tenantId), isNull(table.deletedAt)), // with: { // apis: { // where: (table, { isNull }) => isNull(table.deletedAt), // }, // }, // }); // if (!workspace) { // return redirect("/new"); // } // const apis = await Promise.all( // workspace.apis.map(async (api) => ({ // id: api.id, // name: api.name, // keys: await db // .select({ count: sql`count(*)` }) // .from(schema.keys) // .where(and(eq(schema.keys.keyAuthId, api.keyAuthId!), isNull(schema.keys.deletedAt))), // })), // ); // const unpaid = workspace.tenantId.startsWith("org_") && workspace.plan === "free"; const apis: ApiWithKeys = [ { id: "12", name: "12", keys: [ { count: 1 } ], } ] const unpaid = false return (
{unpaid ? (

Please add billing to your account

Team workspaces is a paid feature. Please add billing to your account to continue using it.

Add billing
) : ( )}
); }