Closed lewebsimple closed 2 weeks ago
When you use useGraphqlQuery
directly in the setup of your page component Nuxt will not be able to generate a payload. Then when running the SSG app it will actually try to make a call to the middleware. However if you wrap it in useAsyncData
, then Nuxt should be able to generate the payload which also works with SSG. The module also simplifies this with the useAsyncGraphqlQuery composable, which basically wraps useAsyncData + useGraphqlQuery.
Duh it was right there in the documentation ... thanks for the quick reply!
I'm trying to use nuxt-graphql-middleware with SSG and it seems to query
/api/graphql_middleware/...
from the client side which crashes the app.Is there a work-around or something I'm missing to pre-render the routes ?