nuxt-graphql-request
nuxt-graphql-request copied to clipboard
How to get requests once with nuxtServerInit on nuxt generate
I know that cache is not handled by this project, but do anyone happen to have a suggestion on how this could be accomplished?
I fetch the data with nuxtServerInit in store/index.js but this will run every time i refresh the page, or many times when the command nuxt generate runs. This is apparently expected behavior for nuxtServerInit and there is extensions you could use to get around this if you use axios.
So is there any similar solution, or any other way that i could do this without fetching data multiply times?
This is something I’d love to figure out to. A “nuxtGenerateInit” function.
I suspect using a plugin with and the generate hook is the way to go, but I’m not sure.
I made this module to solve this: https://github.com/funkhaus/fuxt/tree/master/modules/populate