Skip to content

Commit

Permalink
Update payload URL
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Jul 12, 2024
1 parent 023e4c1 commit 9328d46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/roboshield/src/payload/utils/formatDraftUrl.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down

0 comments on commit 9328d46

Please sign in to comment.