Variable $before doesn’t appear in any GraphQl query
Variable $before doesn’t appear in any GraphQl query
[ad_1]
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.