[Vuejs]-How persisted specific data in localStorage in Nuxt.js?

0👍

From the vuex-persist documentation:

const vuexCookie = new VuexPersistence<State, Payload>({
  restoreState: (key, storage) => Cookies.getJSON(key),
  saveState: (key, state, storage) =>
    Cookies.set(key, state, {
      expires: 3
    }),
  modules: ['user'], //only save user module
  filter: (mutation) => mutation.type == 'logIn' || mutation.type == 'logOut'
})

The options object has a "modules" key that expects a string[] value, with the names of the modules you DO want to serialize.

Constructor param: modules
Value type: string[]
Description: List of modules you want to persist. (Do not write your own reducer if you want to use this)

Leave a comment