0👍
In your current code, every time you call commit('SET_MEMBER_DETAIL', res.data())
, you’re replacing the previous value of SET_MEMBER_DETAIL
. You’ll want to implement SET_MEMBER_DETAIL
as an array, and then push each new member to it. See for example the call to push
in the answer here: Push to vuex store array not working in VueJS.
If retreiveMembers
may be called multiple times, you’ll want to commit an empty array to the list whenever you re-run the query. Something like commit('SET_MEMBER_DETAIL', [])
just before querySnapshot.forEach
in your current code.
- [Vuejs]-Minimalistic build setup for Vuejs without Webpack
- [Vuejs]-How to protect email addresses from being read, but make them searchable on the frontend side with Firestore?
Source:stackexchange.com