feat(12-05): create offer editor route server component
- Add src/app/admin/offers/[id]/edit/page.tsx as async server component - Fetches getOfferEditorData(id) + getOfferFieldOptions() via Promise.all - Calls notFound() when offer id does not exist - Delegates rendering to OfferEditorClient
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
import { notFound } from "next/navigation";
|
||||||
|
import { getOfferEditorData, getOfferFieldOptions } from "@/lib/offer-queries";
|
||||||
|
import { OfferEditorClient } from "@/components/admin/offers/OfferEditorClient";
|
||||||
|
|
||||||
|
export const revalidate = 0;
|
||||||
|
|
||||||
|
export default async function OfferEditPage({
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}) {
|
||||||
|
const { id } = await params;
|
||||||
|
const [data, options] = await Promise.all([
|
||||||
|
getOfferEditorData(id),
|
||||||
|
getOfferFieldOptions(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
notFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return <OfferEditorClient data={data} fieldOptions={options} />;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user