Update to use payload for landing page

This commit is contained in:
2026-03-26 16:14:13 -05:00
parent 0d83380251
commit b678e405c5
13 changed files with 857 additions and 236 deletions

View File

@@ -0,0 +1,24 @@
import type { LandingPageContent } from '@/components/landing/content';
import { cache } from 'react';
import {
defaultLandingPageContent,
mergeLandingPageContent,
} from '@/components/landing/content';
import { getPayloadClient } from './get-payload';
export const getLandingPageContent = cache(
async (): Promise<LandingPageContent> => {
const payload = await getPayloadClient();
const landingPage = await (
payload as {
findGlobal: (args: { slug: string }) => Promise<unknown>;
}
).findGlobal({ slug: 'landing-page' });
return mergeLandingPageContent(
(landingPage as Partial<LandingPageContent> | null | undefined) ??
defaultLandingPageContent,
);
},
);

View File

@@ -0,0 +1,7 @@
import { cache } from 'react';
import config from '@payload-config';
import { getPayload } from 'payload';
export const getPayloadClient = cache(async () => {
return await getPayload({ config });
});