GrahamMorbyDev
6 months ago
658
1
Vue

Vue Persist not working on page reload

Posted 6 months ago by GrahamMorbyDev

Hey Guys

I have installed vue-persist and loading it via vuex.

Every stores ok yet when I reload the browser nothing is being persisted back to the store.

import VuexPersist from "vuex-persist";

const vuexLocal = new VuexPersist({
    key: 'App',
    storage: window.localStorage
  });

export default{
    state: {
        pageTitle: "",
	array: []
      },
    getters:{
        getPageTitle(state) {
            return state.pageTitle;
        }
    },
    actions: {},
    mutations:{
        pageTitle(state, payload) {
            this.state.pageTitle = payload
        },
       },
    plugins: [vuexLocal.plugin]
}

Any help would be grateful

Please sign in or create an account to participate in this conversation.