Currently, I am utilizing vue-persistedstate with specific modules that are set to be persisted using the path
attribute. This setup is functioning smoothly.
However, I encountered an issue when attempting to combine it with the reducer
. In this scenario, the modules specified in the path
no longer persist, and all modules end up being persisted by the reducer instead. How can I properly configure the reducer to only persist the modules listed in the path?
const persistedstate = new createPersistedState({
key: "newsportal-vuex",
storage: window.localStorage,
paths: ["auth", "venues", "play", "playWS", "purchaseSettings"], // only the persisted ones
reducer(val) {
if (!localStorage.getItem("newsportal_isuseracceptcookie")) {
// DO NOT PERSIST STATE IF USER DECLINES COOKIES
return {};
}
return val; // <-this returns ALL MODULES. I want to only include modules from the specified paths
}
});
Thank you in advance for any assistance provided.