here is my code
// search product by title
export const searchProduct = (query, first = 5) => {
return graphQLClient.send(gql(graphQLClient)`
query ($query: String){
products(query: $query, first: 5) {
edges {
cursor
node {
id
title
images (first: 1) {
edges {
node {
id
src
}
}
pageInfo { hasNextPage, hasPreviousPage }
}
description
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}
`, { query })
const query = `title:*${this.keyword}*`
searchProduct(query)
.then(res => {
const products = res.model.products
this.products.push(...products)
this.hasMore = products[products.length - 1].hasNextPage
nextPageProduct = products
})
it is works, but when i use fetchNextPage, it's not work, get error "undefined isn't a defined input type (on $query)"
graphQLClient.fetchNextPage(nextPageProduct)
and here is the fetchNextPage Request
{"query":"query ($query:undefined,$first:Int = 5) { products (query: $query first: $first after: \"eyJsYXN0X2lkIjo1MzY1OTY3MDk0NDIsImxhc3RfdmFsdWUiOjUzNjU5NjcwOTQ0Mn0=\") { pageInfo { hasNextPage,hasPreviousPage },edges { cursor,node { id,title,images (first: 1) { edges { node { id,src } },pageInfo { hasNextPage,hasPreviousPage } },description } } } }","variables":{"query":"title:*Hydro*"}}
can someone tell me how to fix it ?
// package.json
"dependencies": {
"babel-plugin-graphql-js-client-transform": "^1.1.1",
"graphql-js-client": "^0.12.0"
},
here is my code
it is works, but when i use
fetchNextPage, it's not work, get error "undefined isn't a defined input type (on $query)"and here is the fetchNextPage Request
can someone tell me how to fix it ?