Is there any compatible issue with nuxt Auth module and vuex-persist ?
I was added vuex-persist like this.
// Inside - nuxt.config.js
export default {
plugins: [
{ src: '~/plugins/vuex-persist', ssr: false }
]
}
// ~/plugins/vuex-persist.js
import VuexPersistence from 'vuex-persist'
export default ({ store }) => {
window.onNuxtReady(() => {
new VuexPersistence({
/* your options */
}).plugin(store);
});
}
But it fails to work.
Any solution for this?
Yes there was some issues with @nuxtjs/auth
module and vuex-persist
,
use this
// ~/store/index.js
import VuexPersistence from 'vuex-persist'
const vuexLocal = new VuexPersistence({
storage: window.localStorage
})
export const plugins = [vuexLocal.plugin]
instead of this in the documentation
// Inside - nuxt.config.js
export default {
plugins: [
{ src: '~/plugins/vuex-persist', ssr: false }
]
}
// ~/plugins/vuex-persist.js
import VuexPersistence from 'vuex-persist'
export default ({ store }) => {
window.onNuxtReady(() => {
new VuexPersistence({
/* your options */
}).plugin(store);
});
}
or you can use vuex-persistedstate as an alternative.