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

Code error in Statamic guide graphQL query? #8784

Open
sarah11918 opened this issue Jul 11, 2024 · 0 comments
Open

Code error in Statamic guide graphQL query? #8784

sarah11918 opened this issue Jul 11, 2024 · 0 comments
Labels
good first issue Good for newcomers help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@sarah11918
Copy link
Member

📚 Subject area/topic

cms guide

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/guides/cms/statamic/

📋 Description of content that is out-of-date or incorrect

From Feedback Fish:

I'm having trouble with this GraphQL query, it seems to work if I use graphql-request though:

import { request, gql } from "graphql-request";

const page = 1
const query = gql`
  query Entries {
    entries(
      collection: "articles"
      sort: "date asc"
      limit: 20
      page: ${page}
      filter: { locale: ${locale} }
    ) {
      current_page
      has_more_pages
      data {
        id
        slug
        title
      }
    }
  }
`;
const response = await request("https://www.statamic.test/graphql", query);
const entries = response?.entries?.data;

### 🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

_No response_
@sarah11918 sarah11918 added improve documentation Enhance existing documentation (e.g. add an example, improve description) help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. good first issue Good for newcomers help wanted Issues looking for someone to run with them! labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

No branches or pull requests

1 participant