added resolve schema

This commit is contained in:
Rami Bitar
2026-05-02 10:01:13 -04:00
parent 82809b17b4
commit a78249846a
7 changed files with 166 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import { notFound } from "next/navigation";
import { readSchema } from "@/lib/schema.server";
import { resolveSchemaEntry } from "@/lib/schema-resolver";
import RenderClient from "@/components/RenderClient";
export const dynamic = "force-dynamic";
@@ -19,8 +20,8 @@ export default async function Page({
const lookup = route === "/" ? "/" : route.replace(/\/$/, "");
const schema = await readSchema();
const data = schema[lookup];
if (!data) return notFound();
const resolved = resolveSchemaEntry(schema, lookup);
if (!resolved) return notFound();
return <RenderClient data={data} route={lookup} />;
return <RenderClient data={resolved.data} route={lookup} />;
}