2

This is the library: https://github.com/robinvdvleuten/vuex-persistedstate. I created the following plugin file for Nuxt.

import createPersistedState from 'vuex-persistedstate'

export default ({ store }) => {
  createPersistedState()(store)
}

The problem is I am not sure how I can exlude certain stores since this persists all the stores.

mntymccass
  • 27
  • 1

2 Answers2

0

The repo you're sharing is archived as of today so you should probably pass on it and switch to Pinia.

There are 2 packages doing that with Pinia:

Otherwise, a homemade solution may be needed but vuex-persistedstate will not allow you to select a store as you initially wanted.

kissu
  • 40,416
  • 14
  • 65
  • 133
0
export default ({ store }) => {
  createPersistedState({
    paths: ["myData", "someOtherData"],
  })(store);
};

You can reference state you want to persist as a value to paths. If you use vuex modules its "moduleName.myData".

oivind
  • 301
  • 3
  • 10