mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Links and data fetching for dynamic routes
This commit is contained in:
@@ -1,23 +1,13 @@
|
||||
import DynamicContentManager from '@/components/layout/dynamic-content-manager/dynamic-content-manager';
|
||||
import { clientFetch } from '@/lib/sanity/sanity.client';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
interface SinglePageParams {
|
||||
query: string;
|
||||
queryParams: {
|
||||
slug: string;
|
||||
locale: string;
|
||||
};
|
||||
data: object | any;
|
||||
}
|
||||
|
||||
export default async function SinglePage({ query = '', queryParams }: SinglePageParams) {
|
||||
const page = await clientFetch(query, queryParams);
|
||||
|
||||
if (!page) return notFound();
|
||||
|
||||
export default async function SinglePage({ data }: SinglePageParams) {
|
||||
return (
|
||||
<div>
|
||||
<DynamicContentManager content={page?.content} />;
|
||||
</div>
|
||||
<>
|
||||
<DynamicContentManager content={data?.content} />;
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user