Live preview when editting website! Very cool!
This commit is contained in:
@@ -8,13 +8,16 @@ import {
|
||||
import { getPayloadClient } from './get-payload';
|
||||
|
||||
export const getLandingPageContent = cache(
|
||||
async (): Promise<LandingPageContent> => {
|
||||
async (isPreview = false): Promise<LandingPageContent> => {
|
||||
const payload = await getPayloadClient();
|
||||
const landingPage = await (
|
||||
payload as {
|
||||
findGlobal: (args: { slug: string }) => Promise<unknown>;
|
||||
findGlobal: (args: {
|
||||
slug: string;
|
||||
draft?: boolean;
|
||||
}) => Promise<unknown>;
|
||||
}
|
||||
).findGlobal({ slug: 'landing-page' });
|
||||
).findGlobal({ slug: 'landing-page', draft: isPreview });
|
||||
|
||||
return mergeLandingPageContent(
|
||||
(landingPage as Partial<LandingPageContent> | null | undefined) ??
|
||||
|
||||
Reference in New Issue
Block a user