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

Content stage only showing Draft & not Published #266

Open
SanyamPunia opened this issue Apr 18, 2023 · 2 comments
Open

Content stage only showing Draft & not Published #266

SanyamPunia opened this issue Apr 18, 2023 · 2 comments

Comments

@SanyamPunia
Copy link

I've published two documents on the CMS and I'm fetching + rendering them inside my Next.js application.

I want to render only those documents which are in the published stage, and not in draft.

When I fetch the content using GraphQL in the API playground, the stage attribute is always in the draft stage, even after I published it.


GraphQL query

query getBlogStage{
  portfolioBlogs {
    id
    title
    stage
  }
}

Output

image

In the specific content, it's also showing the published stage

image

I would appreciate if anyone could find possible fix for this.

@TontofourK
Copy link

Yeah, I am also stuck with the same issue. Please share a possible fix

@notrab
Copy link
Contributor

notrab commented May 15, 2023

Hey @SanyamPunia @TontofourK

Have you tried updating the query to include a stage argument? Something like this should work for you...

query getBlogStage {
  portfolioBlogs(stage: PUBLISHED) {
    id
    title
    stage
  }
}

This is because the "default stage" is DRAFT. You can alternatively update the Playground to use the Published stage. This essentially does the above for playground purposes but you should always set the stage in the query.

CleanShot 2023-05-15 at 12 34 03@2x

You can also set your access tokens to have a specific stage scoped which is what I do in 99.9% of the time.

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

No branches or pull requests

3 participants