#When ?draft=true, show latest draft

8 messages · Page 1 of 1 (latest)

sullen stream
#

I am building a landing page with Payload, and drafts are enabled for this project.

The problem is: when the latest version is with "Published" status and I send ?draft=true to the GET request, I still get the "Published" version instead of the latest "Draft" version.

What I expect is:
When ?draft=true, return the latest draft;
When ?draft=false, return the latest published version.

How can I achieve this?

warped lakeBOT
atomic forge
#

Let me know if after reading that, you're still stuck

pliant ember
#

@blazing vector

This section of the documentation says:

"But, if you specify draft as true, Payload will automatically replace your published document's content with content coming from the most recently saved version"

And now I got it. But still, what I want is that the draft=true replaces the published document's content with content coming from the most recently saved draft, not version. Is that possible?

atomic forge
#

hmm

#

I also see it says

#

If draft is set to true while reading a document, Payload will automatically replace returned document(s) with their newest drafts if any newer drafts are available.