Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: supports live preview url as function #3455

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Oct 6, 2023

Live Preview url now accepts a function:

url?:
    | ((args: { data: Record<string, any>; documentInfo: ContextType; locale: Locale }) => string)
    | string

So we can do things like generate complex, dynamic URLs on the fly like this:

url: ({ data, documentInfo, locale }) => `${process.env.PAYLOAD_URL}/${documentInfo.slug}/${data?.slug}?locale=${locale}`,

@jacobsfletch jacobsfletch merged commit 5bc8103 into 2.0 Oct 6, 2023
11 of 12 checks passed
@jacobsfletch jacobsfletch deleted the 2_0/live-preview-url-func branch October 6, 2023 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant