How can I access the $prismic API from a Pinia store?

The $prismic API is available in Vuex as described here (Fetching Content - @nuxtjs/prismic). However, I'm having trouble accessing this from Pinia. Any tips on how to reach it?

Hey @bassplayer7, how are you making your page queries?
Can you show us an example?

I found out that Pinia includes $nuxt in it's context. So this works:

this.$nuxt.$prismic.api.getSingle(/*...*/)
1 Like

Thanks for sharing your solution @bassplayer7!