Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

omrdev's avatar

Fetching data into the state of a Pinia store

Hi, I have a question regarding fetching data into the state of a Pinia store from an API

in my application I have 3 routes: Dashboard, Programs, Modules

Dashboard shows stats about programs and modules Programs and Modules show list of records

I call getPrograms and getModules from their corresponding components

and I also need to call them from the dashboard component

now each time I visit a route the request will be sent to get the data, here I can add a guard to the actions to only fire when the state is not already seeded with data but I'm not sure if there is a better way to do it?

Thank you!

0 likes
1 reply

Please or to participate in this conversation.