mesqueeb / vuex-easy-firestore

Easy coupling of firestore and a vuex module. 2-way sync with 0 boilerplate!
https://mesqueeb.github.io/vuex-easy-firestore
MIT License
234 stars 28 forks source link

After a user logs out of firebase the state keeps data #310

Closed xorbis closed 4 years ago

xorbis commented 4 years ago

I am wondering how to cleanup the VueX state once a user logs out. Is there something I am missing in the documentation or is it obvious?

The problem is that if I login a user and fetch some data and then logout, the data will still be present in the view from the previous user session.

mesqueeb commented 4 years ago

closeDBChannel with clearModule param? I’m outside now but once i’m back i’ll link the proper docs!!

Sent with GitHawk

xorbis commented 4 years ago

Hi thanks for the reply. I am currently using fetchAndAdd not openDBChannel.

mesqueeb commented 4 years ago

Hi @xorbis I only ever built this function for openDBChannel, however, if you look here, you'll see that the closeDBChannel just commits a mutation: https://github.com/mesqueeb/vuex-easy-firestore/blob/master/src/module/actions.ts#L812

commit('RESET_VUEX_EASY_FIRESTORE_STATE')

You can commit this mutation to reset the state. And if you want to know exactly what this mutation does, it's here: https://github.com/mesqueeb/vuex-easy-firestore/blob/master/src/module/mutations.ts#L44

This will be handled differently in v2.0 which is now being developed. 😉

--
Vuex Easy Firestore was made with ♥ by Luca Ban.
If you use this library in your projects, you can support the maintenance of this library by a small contribution via Github 💜.
You can also reach out on twitter if you want a one-on-one coding review/lesson. 🦜

xorbis commented 4 years ago

Thanks, will try ASAP.