I am looking to generate certain routes from Apollo (GraphQL) not using Axios, which all demo's seem to use.
...
apollo: {
networkInterfaces: {
default: '~/apollo/network-interfaces/default.js'
},
clientConfigs: {
default: '~/apollo/client-configs/default.js'
},
allArticles: {
query: '~/apollo/queries/allArticles'
}
},
generate: {
routes: function () {
return allArticles.data.map((article) => {
return {
route: '/articles/' + article.id,
payload: article
}
})
}
...
The issue is I am not able to access 'allArticles'
Generating routes
Could not resolve routes
TypeError: Cannot read property 'data' of undefined
I am able to do this on my Vue Component but not sure if there is anything special I need for using it in the nuxt.config.js
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1976">#c1976</a>)</em></sub></div>