feat: add pinia stores (#170)
This commit is contained in:
1 parent
423b506d70
commit
4a412acc9e
11 files changed
+96
-88
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { createPinia } from 'pinia'
|
||||
import { UserModule } from '~/types'
|
||||
|
||||
export const install: UserModule = ({ isClient, initialState, app }) => {
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
// Refer to
|
||||
// https://github.com/antfu/vite-ssg/blob/main/README.md#state-serialization
|
||||
// for other serialization strategies.
|
||||
if (isClient)
|
||||
pinia.state.value = (initialState.pinia) || {}
|
||||
|
||||
else
|
||||
initialState.pinia = pinia.state.value
|
||||
}
|
||||
Reference in new issue
Block a user