From 925765233e346d08ab060dc021eefc34560332da Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 26 Feb 2026 03:13:33 +0100 Subject: [PATCH] fix: retrieve drafts on staging --- lib/blog.ts | 4 ++-- lib/products.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/blog.ts b/lib/blog.ts index 947fee0f..f233ffb7 100644 --- a/lib/blog.ts +++ b/lib/blog.ts @@ -59,7 +59,7 @@ export async function getPostBySlug(slug: string, locale: string): Promise { try { const payload = await getPayload({ config: configPromise }); - const isDev = process.env.NODE_ENV === 'development'; + const isDev = process.env.NODE_ENV === 'development' || process.env.TARGET === 'staging'; const { docs } = await payload.find({ collection: 'posts', where: { diff --git a/lib/products.ts b/lib/products.ts index 11e99e13..22cc3a0a 100644 --- a/lib/products.ts +++ b/lib/products.ts @@ -26,7 +26,7 @@ export async function getProductMetadata( const payload = await getPayload({ config: configPromise }); const fileSlug = await mapSlugToFileSlug(slug, locale); - const isDev = process.env.NODE_ENV === 'development'; + const isDev = process.env.NODE_ENV === 'development' || process.env.TARGET === 'staging'; const result = await payload.find({ collection: 'products', where: { @@ -70,7 +70,7 @@ export async function getProductBySlug(slug: string, locale: string): Promise { try { const payload = await getPayload({ config: configPromise }); - const isDev = process.env.NODE_ENV === 'development'; + const isDev = process.env.NODE_ENV === 'development' || process.env.TARGET === 'staging'; const result = await payload.find({ collection: 'products', where: { @@ -157,7 +157,7 @@ export async function getAllProducts(locale: string): Promise { images: true, } as const; - const isDev = process.env.NODE_ENV === 'development'; + const isDev = process.env.NODE_ENV === 'development' || process.env.TARGET === 'staging'; const result = await payload.find({ collection: 'products', where: {