Newbie : Auto-reload the pinia state ( fetching from the firebase ) after I add new documents added in other pages. #9913
Unanswered
geloocli
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys, can you help me I have a problem with not updating state in my component after I add new item from the database.
`async function getBatch() {
const batch = []
const querySnapshot = await getDocs( collection(db, "batch") );
querySnapshot.forEach((doc) => {
batch.push( doc.data() )
});
return batch
}
export const useBatchStore = defineStore( 'batch', () => {
const batch = ref( getBatch() )
return { batch, }
})`
this batch is what i'm rendering. I want it to reload everytime i added a new document. How can I do that?
Beta Was this translation helpful? Give feedback.
All reactions