From a5e6174242b9ea5da540459fbf3c2906429b3034 Mon Sep 17 00:00:00 2001 From: makearmy Date: Thu, 2 Oct 2025 20:32:19 -0400 Subject: [PATCH] dx route update --- app/api/dx/[...path]/route.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/api/dx/[...path]/route.ts b/app/api/dx/[...path]/route.ts index 91530049..43eb5d02 100644 --- a/app/api/dx/[...path]/route.ts +++ b/app/api/dx/[...path]/route.ts @@ -4,17 +4,19 @@ import { dxGET } from "@/lib/directus"; import { requireBearer } from "@/app/api/_lib/auth"; export const runtime = "nodejs"; +export const dynamic = "force-dynamic"; // proxy to Directus; never static // GET /api/dx/? // Proxies to Directus using the user's ma_at, no caching. -export async function GET( - req: Request, - { params }: { params: { path: string[] } } -) { +export async function GET(req: Request, context: any) { try { - const bearer = requireBearer(req); // <-- pulls ma_at from Cookie - const search = new URL(req.url).search; // keep original query - const p = `/${(params.path || []).join("/")}${search || ""}`; + const bearer = requireBearer(req); // ← pulls ma_at from Cookie + const search = new URL(req.url).search || ""; + const params = (context?.params ?? {}) as { path?: string[] }; + + const pathParts = Array.isArray(params.path) ? params.path : []; + const p = `/${pathParts.join("/")}${search}`; + const json = await dxGET(p, bearer); return NextResponse.json(json, { status: 200 }); } catch (e: any) {