Fetch data from an API using Pinia in Nuxt 3 #2654
-
I'm struggling to work out the best way to fetch data from an API in Pinia within a Nuxt 3 project, in order to then be able to access that data in the store when my static site is generated. I have seen suggestions for getters and actions, something along the lines of the below:
but I'm not sure which option is correct and how to then run the fetch and access the data within a component. Any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, This is how you should use it inside your component. NOTE: I made a small change in the store that should not affect the functionality
|
Beta Was this translation helpful? Give feedback.
Hello,
This is how you should use it inside your component.
NOTE: I made a small change in the store that should not affect the functionality