Skip to content

Commit ad3c339

Browse files
authored
fix(dashboard): section detail 404 — use flat /v1/sections/{id} (#10)
The section-detail API route forwarded to /v1/documents/{docId}/sections/ {id}, which the engine does not expose (it only has the flat /v1/sections/{id}, scoped by the org header). Every section-detail view returned 'Section not found'. Point it at the correct endpoint.
1 parent 16d2ab9 commit ad3c339

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]

apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]/route.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ export async function GET(
55
_request: NextRequest,
66
{ params }: { params: Promise<{ docId: string; sectionId: string }> },
77
) {
8-
const { docId, sectionId } = await params;
9-
const { ok, status, data } = await forwardToCP(
10-
`/v1/documents/${docId}/sections/${sectionId}`,
11-
);
8+
// The engine exposes sections at the flat /v1/sections/{id} path (scoped
9+
// by the org header), not nested under the document. docId is only part
10+
// of the dashboard URL/breadcrumb.
11+
const { sectionId } = await params;
12+
const { ok, status, data } = await forwardToCP(`/v1/sections/${sectionId}`);
1213
if (!ok) {
1314
return NextResponse.json(data ?? { error: "Upstream error" }, { status });
1415
}

0 commit comments

Comments
 (0)