34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { getAllApis } from "@/lib/wiki";
|
|
import Article from '@/components/wiki/Article';
|
|
import { API } from '@/components/mdx-components';
|
|
|
|
export default async function Page() {
|
|
const allApis = await getAllApis();
|
|
|
|
// Gruppiert die APIs nach ihrer Kategorie
|
|
const groupedApis = Object.groupBy(allApis, (api) => api.category);
|
|
|
|
return (
|
|
<Article title="API-Endpunkte">
|
|
{Object.entries(groupedApis).map(([category, apis]) => (
|
|
<div key={category} className="mb-10">
|
|
{/* Kategorie-Überschrift wird nur EINMAL pro Kategorie gerendert */}
|
|
<h2 className="text-2xl font-bold text-white mt-10 mb-4 border-b border-zinc-800 pb-2">
|
|
{category}
|
|
</h2>
|
|
|
|
{/* Routen innerhalb dieser Kategorie durchgehen */}
|
|
{apis?.map((api, index) => (
|
|
<div key={index} className="my-4">
|
|
{api.methods.map((method, mIndex) => (
|
|
<API route={api.route} method={method.method} key={mIndex}>
|
|
{method.description}
|
|
</API>
|
|
))}
|
|
</div>
|
|
))}
|
|
</div>
|
|
))}
|
|
</Article>
|
|
);
|
|
} |