Q:

How to use createPersistedState in a vuex and quasar application?

How to use createPersistedState in a vuex and quasar application?
I am trying to persist some daos in the cookie of my application, however the data is not being written in the cookie.
What am I doing wrong?
Thank you in advance for your attention of all.
Action
function setUser ({ commit }) {
  axios.get(`/modulo/app`, { headers: { 'Authorization': 'Bearer ' + store.getters.getToken() } })
    .then(response => {
      commit('setUserMutation', response.data)
    })
    .catch(error => {
      if (!error.response) {
        console.log(error.response)
      }
    })
}

Mutation
const setUserMutation = (state, data) => { state.user = data }

Getters
function getUser (state) {
  return state.user
}

index config Store
export default function () {
  const Store = new Vuex.Store({
    modules: {
      auth
    },
    plugins: [createPersistedState(
      {
        paths: ['auth.setUserMutation'],
        storage: {
          getItem: key => Cookies.get(key),
          setItem: (key, value) => Cookies.set(key, value, { expires: 3, secure: true }),
          removeItem: key => Cookies.remove(key)
        }
      }
    )],
    strict: process.env.DEV
  })
  return Store
}

A:

most likely it's due to the secure props you use in Cookie.set

secure
Either true or false, indicating if the cookie transmission requires a secure protocol (https).
-https://github.com/js-cookie/js-cookie

If you are developing on localhost, it most likely is not using HTTPS.
You can set the secure value to be based on your environment, by using env variable
secure: process.env.NODE_ENV === 'production'

