useNuxtApp inside an action throws error #835
-
Hello! I am trying to run useNuxtApp() inside pinia but it doesn't work.
I need to access to it cause from my server Full reproduction:
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This is normal, it's the same as calling pinia.use(() => ({ $app: markRaw(useNuxtApp()) })) You have access to the nuxt context as |
Beta Was this translation helpful? Give feedback.
-
While answering I've found It's a little bit strange to me :) Don't want to be boring just talking :) Thank you 💚 |
Beta Was this translation helpful? Give feedback.
This is normal, it's the same as calling
useNuxtApp()
inside a component method rather that at thesetup()
level. You need to put it in a plugin instead:You have access to the nuxt context as
this.$nuxt
but I can't remember if it contains the nuxt app and all the differences between Nuxt 2, bridge, and 3