• Resolved rmehi

    (@rmehi)


    I want to create headless wordpress with next.js. But when I want to create pagination I can not use before state in my query. I have added picture and my query below, my variables works fine. I have checked them

    const query = `
      query allPosts($after: String = "", $before: String = "", $first: Int) {
        posts(first: $first, after: $after, before : $before) {
          edges {
            node {
              author {
                node {
                  name
                }
              }
              id
              title
              date
              excerpt
              featuredImage {
                node {
                  sourceUrl
                  title
                }
              }
              uri
              slug
              categories {
                nodes {
                  uri
                  count
                  databaseId
                  id
                  name
                  parent {
                    node {
                      uri
                      count
                      databaseId
                      id
                      name
                    }
                  }
                }
              }
            }
          }
          pageInfo {
            hasNextPage
            hasPreviousPage
            endCursor
            startCursor
          }
        }
      }`;
    • This topic was modified 1 year, 1 month ago by rmehi.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Variable $before doesn’t appear in any GraphQl query’ is closed to new replies.