Question and localforage in `modules` not `buildModules`

commented a year ago


Any notes on the new version? :)
I am still on 1.0.2

I am doing something typical, reloading the storage when the app is loaded. My approach so far is to put it in the create method of my default layout. obviously that is problematical since I would need to do that in all other layouts. I was thinking about doing this in an middleware, however I just noticed, that the localforage is not available in the context of the middleware. I was checking the documentation, to see if there is something about that… Doing that I realized I have localforage in modules not buildModules. However changing that, my index page doesn't load anymore…

I am doing something like this in the default layout:

    created() {
      if (!this.$store.getters[DB_LOADED]())
        reload_storage(this.$store, this.$localForage) 

db_loaded is a flag in my store which is set after localForage is loaded. Then in a watch method to that store variable I fetch stuff from the server and set another flag in the store to initialized, which will finally allows the page to be created:

      <v-container v-if="initialized">

There is probably a better way to do all these initial steps involving the localforage. Any guidelines would be really appreciated.

#c12 - Created a year ago