N
Nuxt3y ago
Yaiko

useFetch in Nuxt Plugin

Environment - Operating System: Darwin - Node Version: v16.14.0 - Nuxt Version: 3.0.0-rc.14 - Nitro Version: 1.0.0 - Package Manager: [email protected] - Builder: vite - User Config: css, build, modules - Runtime Modules: @pinia/[email protected], () - Build Modules: - Reproduction Reproduction link: https://stackblitz.com/edit/github-9edfuk Describe the bug I'm trying to understand how the Server-side requests can work, I'm trying to use a useFetch inside a defineNuxtPlugin to get the user data before loading the page on client side but I'm getting: [Vue warn]: onServerPrefetch is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement. In the docs says useFetch can be used inside plugins, but I'm getting this warning. https://nuxt.com/docs/getting-started/data-fetching#usefetch
Yaiko
StackBlitz
Nuxt - Starter - StackBlitz
🪄 Nuxt Starter Templates
Nuxt
Data Fetching · Get Started with Nuxt
Nuxt provides composables to handle data fetching within your application.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server