Tried some updates

This commit is contained in:
Henrik Larsson
2023-08-13 14:36:35 +02:00
parent ac9d8c4386
commit 524b9c5818
9 changed files with 41 additions and 34 deletions

View File

@@ -2,9 +2,10 @@ import getQueryFromSlug from '@/helpers/get-query-from-slug';
import { clientFetch } from 'lib/sanity/sanity.client';
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import CategoryPage from './components/category-page';
import ProductPage from './components/product-page';
import SinglePage from './components/single-page';
import CategoryPage from './pages/category-page';
import HomePage from './pages/home-page';
import ProductPage from './pages/product-page';
import SinglePage from './pages/single-page';
export const runtime = 'edge';
@@ -48,6 +49,7 @@ export default async function Page({ params }: PageParams) {
return (
<>
{docType === 'home' && <HomePage query={query} queryParams={queryParams} />}
{docType === 'page' && <SinglePage query={query} queryParams={queryParams} />}
{docType === 'product' && <ProductPage query={query} queryParams={queryParams} />}
{docType === 'category' && <CategoryPage query={query} queryParams={queryParams} />}

View File

@@ -0,0 +1,22 @@
import DynamicContentManager from '@/components/layout/dynamic-content-manager/dynamic-content-manager';
import { clientFetch } from '@/lib/sanity/sanity.client';
import { notFound } from 'next/navigation';
interface HomePageParams {
query: string;
queryParams: {
locale: string;
};
}
export default async function HomePage({ query = '', queryParams }: HomePageParams) {
const homePage = await clientFetch(query, queryParams);
if (!homePage) return notFound();
return (
<div>
<DynamicContentManager content={homePage?.content} />;
</div>
);
}