Skip to content

Commit

Permalink
Fix URLS error
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Jul 12, 2024
1 parent 9328d46 commit 56e0771
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions apps/roboshield/src/payload/utils/formatDraftUrl.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import formatPagePath from "./formatPagePath";
import { Document } from "payload/types";

const payloadUrl = process.env.PAYLOAD_PUBLIC_APP_URL || process.env.NEXT_PUBLIC_APP_URL;
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}`,
payloadUrl,
);
const url = new URL(`/api/draft?slug=${slug}`, payloadUrl);
return url.href;
}
return null;
Expand Down

0 comments on commit 56e0771

Please sign in to comment.