diff --git a/apps/roboshield/src/payload/utils/formatDraftUrl.ts b/apps/roboshield/src/payload/utils/formatDraftUrl.ts index 9f402dc3c..95bdac0bb 100644 --- a/apps/roboshield/src/payload/utils/formatDraftUrl.ts +++ b/apps/roboshield/src/payload/utils/formatDraftUrl.ts @@ -1,12 +1,14 @@ import formatPagePath from "./formatPagePath"; import { Document } from "payload/types"; + +const payloadUrl = process.env.PAYLOAD_PUBLIC_APP_URL || process.env.NEXT_PUBLIC_APP_URL; function formatDraftUrl(collection: string, doc: Document) { const pagePath = formatPagePath(collection, doc); if (pagePath) { const slug = pagePath; const url = new URL( `/api/draft?slug=${slug}`, - process.env.PAYLOAD_PUBLIC_APP_URL, + payloadUrl, ); return url.href; }