Мне нужно выполнить несколько запросов graphQL внутри компонента и в файле gatsby-node.js
. (Поскольку Prismi c ограничен 20 записями на ответ ... ?)
Я попробовал следующее, просто чтобы посмотреть, смогу ли я создать graphql l oop в функции по умолчанию:
export default () => {
async function allPosts() {
let data
await graphql(`
query allDitherImages {
prismic {
allProjects(sortBy: meta_firstPublicationDate_DESC) {
totalCount
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
edges {
node {
cover_image
cover_imageSharp {
name
}
}
}
}
}
}
`).then(initialRes => {
data = initialRes
})
return data
}
allPosts().then(result => {
console.log(result)
})
return null
}
Но тогда Гэтсби говорит мне, что Gatsby related 'graphql' calls are supposed to only be evaluated at compile time, and then compiled away. Unfortunately, something went wrong and the query was left in the compiled code.
Как я могу выполнить несколько запросов к GraphQL?
Заранее спасибо :) Михаил