You can take a look at the wishlist module:
import { ActionTree } from 'vuex'
import * as types from './mutation-types'
import RootState from '@vue-storefront/core/types/RootState'
import WishlistState from '../types/WishlistState'
import { StorageManager } from '@vue-storefront/core/lib/storage-manager'
const actions: ActionTree<WishlistState, RootState> = {
clear (context) {
context.commit(types.WISH_DEL_ALL_ITEMS, [])
},
async load ({ commit, getters, dispatch }, force: boolean = false) {
if (!force && getters.isWishlistLoaded) return
commit(types.SET_WISHLIST_LOADED)
const storedItems = await dispatch('loadFromCache')
commit(types.WISH_LOAD_WISH, storedItems)
},
loadFromCache () {
const wishlistStorage = StorageManager.get('wishlist')
return wishlistStorage.getItem('current-wishlist')
},
This file has been truncated. show original
and based on it, create your own module in
src/modules
didn’t check, but this line:
loadFromCache () {
const wishlistStorage = StorageManager.get('wishlist')
return wishlistStorage.getItem('current-wishlist')
}
seems to be responsible for reading the localstorage keys at shop/wishlist/current-wishlist
localstorage key which you can see being used on https://demo.vuestorefront.io/
the above should give you a good starting point on implementing your own keys and groups