We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eecdeef commit 78468f3Copy full SHA for 78468f3
1 file changed
src/runtime/plugin.ts
@@ -1,13 +1,15 @@
1
import { createPersistedStatePlugin } from 'pinia-plugin-persistedstate-2'
2
import { defineNuxtPlugin } from 'nuxt/app'
3
-import { usePinia } from 'pinia'
4
import { get, set, del } from 'idb-keyval'
5
6
export default defineNuxtPlugin({
7
name: 'owd-plugin-persistence',
8
parallel: true,
9
- async setup() {
10
- const pinia = usePinia()
+ async setup(nuxtApp) {
+ const pinia = nuxtApp.$pinia
+ if (!pinia) {
11
+ return
12
+ }
13
14
pinia.use(
15
createPersistedStatePlugin({
0 commit comments