[Vuejs]-Vue router have not seen store state

0👍

Looks like this problem is in implementation of saving\retrieving store from localStorage. I suggest you to not re-invent the wheel and use this package instead which will solve your problem:
https://www.npmjs.com/package/vuex-persistedstate

import createPersistedState from 'vuex-persistedstate'

const store = new Vuex.Store({
  // ...
  plugins: [createPersistedState()]
})

0👍

You should try import store before router like

import Vue from 'vue';
import router from './router';
import store from './store';
import App from './App.vue';
new Vue({ 
    store,
    router,
    render: (h) => h(App)
}).$mount('#app');

Leave a comment