How would I pass props into pinia store? #1266
Unanswered
IamShaDoW666
asked this question in
Help and Questions
Replies: 2 comments 1 reply
-
2 years later, no one has an answer? :( I want to create a store where I can decide weither the data is fetched on server side or on client side: export const useMyStore = defineStore('my-store', (server: boolean) => {
const { pending, data, error } = useLazyFetch<MyResponse>('/api/my-api', {server});
return {
// State
data,
pending,
error,
// Getters
// Actions
};
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
This was helpful in my case, while refreshing the state
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using vue3 composition API with InertiaJS integration. I have some objects that I receive from controllers using
props: { products: Object }
I want to pass the products prop into my Pinia Store. Is there any way?
Using composables I could do
const store = useStore(props)
But this is not possible using Pinia store.
Please respond if you know a way to tackle this.
Beta Was this translation helpful? Give feedback.
All reactions