From 4296f37eaa7e645a9278b1bc2fec9dc1eb2d4562 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Tue, 22 Sep 2026 17:51:00 +0200 Subject: [PATCH] fix(internal/site): use the standard api client in the org layout --- internal/site/app/(app)/[organization]/layout.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/site/app/(app)/[organization]/layout.tsx b/internal/site/app/(app)/[organization]/layout.tsx index 0b5f0c94..3620f02c 100644 --- a/internal/site/app/(app)/[organization]/layout.tsx +++ b/internal/site/app/(app)/[organization]/layout.tsx @@ -1,8 +1,8 @@ -import Client from "@blink.so/api"; import * as convert from "@blink.so/database/convert"; import { notFound, redirect } from "next/navigation"; import { cache } from "react"; -import { auth, getSessionToken } from "@/app/(auth)/auth"; +import { auth } from "@/app/(auth)/auth"; +import { getAPIClient } from "@/lib/api-client.server"; import { getQuerier } from "@/lib/database"; export default async function OrganizationLayout({ @@ -75,12 +75,7 @@ export const getAgent = cache( export const getAgentOrNull = cache( async (organizationName: string, agentName: string) => { const session = await auth(); - const token = await getSessionToken(); - const baseURL = process.env.NEXT_PUBLIC_BASE_URL ?? "http://localhost:3005"; - const client = new Client({ - baseURL, - authToken: token, - }); + const client = await getAPIClient(); const userID = session?.user?.id; const db = await getQuerier(); const agentFromDB = await db.selectAgentByNameForUser({