import type { App } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

/** 供 setup 外（WithOut）使用的同一 Pinia 实例 */
export const store = pinia

export const setupStore = (app: App<Element>) => {
    app.use(pinia)
}

export default pinia
