nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
641 stars 99 forks source link

What is the best way for clear persistence data ? #523

Open tibs245 opened 3 years ago

tibs245 commented 3 years ago

Hi,

I want clear all firestore data (persisted) on disconnection :

this.$fireModule
  .firestore()
  .clearPersistence()
  .catch((error) => {
    console.error(
      'Thank you to delete app data manually",
      error.code
    )
  })

But I have error because app is initialized: FirebaseError: Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.

What is the best way for clear all firestore data ?

lupas commented 3 years ago

Hey @tibs245

Currently this will be hard to do, but we could probably implement this as an option similarly to how we do it for enablePersistence: https://firebase.nuxtjs.org/service-options/firestore#enablepersistence

Won't have time the next few weeks, feel free to create a PR for it if you need the feature :)

br, Pascal