import { createPinia } from 'pinia' import { createPersistedState } from 'pinia-plugin-persistedstate' import { StorageKeyManager } from '@/utils/storage/storage-key-manager' const store = createPinia() const storageKeyManager = new StorageKeyManager() store.use( createPersistedState({ key: (storeId) => storageKeyManager.getStorageKey(storeId), storage: localStorage, serializer: { serialize: JSON.stringify, deserialize: JSON.parse } }) ) function initStore(app) { app.use(store) } export { initStore, store }