How to set individual IndexedDb storage per user email

Hi, I tried asking for help on stackoverflow but couldn’t get any helpful answers. I hope I get some help here.

I suggest

  1. Seperate firebase onAuthStateChange (ex: module1 ) and localforage creation logic(Ex: module2 ) in two different modules, import both in parent file.
  2. Write a method which takes userEmail as argument and retuns localforage instance in module2 and export that method(ex: createLocalForageInstance ).
  3. Generate a custom event and emit it from onAuthStateChange and listen to it in parent file and from there call createLocalForageInstance .

If handling async code is the only issue than above approach should work.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.