Variable $before doesn’t appear in any GraphQl query

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 6 hours, 18 minutes ago by rmehi.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer