Is it possible to access Nuxt context from a pinia sotre?
See original GitHub issueFirst of all thanks for this awesome library.
When I’m using nuxt to build my apps, I normally tend to use Nuxt axios and auth modules for instance and have my API methods wrapped around vuex accessing this.$axios
to perform HTTP requests without being worried about authentication and other configuration stuff.
I want to know if it is possible to have nuxt context injected inside my pinia store so i can keep using this pattern? If so how can I achieve this?
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Is it possible to access Nuxt context from a pinia sotre? #186
I want to know if it is possible to have nuxt context injected inside my pinia store so i can keep using this...
Read more >Nuxt.js - Pinia
Using Pinia with Nuxt.js is easier since Nuxt takes care of a lot of things when it comes to server side rendering. For...
Read more >Context and Helpers - Nuxt
First and foremost, the context is used to provide access to other parts of the Nuxt application, e.g. the Vuex store or the...
Read more >Using Modules and Pinia to structure Nuxt 3 app
Is it possible to use Pinia without a component in the module to store data eg: logged in user data and access it...
Read more >How to use the nuxt context in an vuex store? - Storyblok
Using the current Nuxt context and therefore $storyapi and $storybridge the easiest way to achieve that is to pass the parts of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added
$nuxt
to the plugin: https://pinia.esm.dev/ssr/nuxt.html#using-the-nuxt-context-in-storesOk, after digging a bit I found that with nuxt-composition-api all you have to do is call
useContext
and everything works.Note I’m doing in spa mode IDK if it work as intended on SSR but the docs says it does.