profile
viewpoint

Ask questionsWebstore instance lost on page refresh

I'm using vue js 2. I have a main file with this code:

 import Vue from 'vue'
 import App from './App.vue'
 import router from './router'

const Store = require('secure-webstore').Store

const store = new Store('user_data', 'lachiquichiqui89')

store.init().then(() => {
  // store is ready
})

Vue.prototype.$store = store

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

This is working fine...I already store some data in indexeddb....but when I refresh the page, I think maybe the instance is lost, because I'm getting this error trying to get the store object inside a component:

Error: Master key not initialized
at Store.get key [as key] (secure-webstore.js?ee28:31)
at Store.eval (secure-webstore.js?ee28:87)
at Generator.next (<anonymous>)
at fulfilled (secure-webstore.js?ee28:4)

And data it's ok!!, so I don't know how to solve it...please help! cap

AKASHAorg/secure-webstore

Answer questions Master-Y0da

@deiu oh!...the first one:

Vue.prototype.$store.get('user')

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List