We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2b8a03 commit 88566aaCopy full SHA for 88566aa
website/src/app/api/data-attr/[component]/route.ts
@@ -0,0 +1,20 @@
1
+import { type DataAttrDocKey, getDataAttrDoc } from '@zag-js/docs'
2
+import type { NextRequest } from 'next/server'
3
+
4
+type Params = Promise<{ component: string }>
5
6
+export const GET = async (_: NextRequest, segmentData: { params: Params }) => {
7
+ const { component } = await segmentData.params
8
9
+ if (!component) {
10
+ return Response.json({ error: 'Component parameter is required' }, { status: 400 })
11
+ }
12
13
+ const dataAttrDoc = getDataAttrDoc(component as DataAttrDocKey)
14
15
+ if (!dataAttrDoc) {
16
+ return Response.json({ error: 'Component not found in documentation' }, { status: 404 })
17
18
19
+ return Response.json(dataAttrDoc)
20
+}
0 commit comments