Skip to content

Commit 78468f3

Browse files
committed
fix: fix pinia usage
1 parent eecdeef commit 78468f3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/runtime/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { createPersistedStatePlugin } from 'pinia-plugin-persistedstate-2'
22
import { defineNuxtPlugin } from 'nuxt/app'
3-
import { usePinia } from 'pinia'
43
import { get, set, del } from 'idb-keyval'
54

65
export default defineNuxtPlugin({
76
name: 'owd-plugin-persistence',
87
parallel: true,
9-
async setup() {
10-
const pinia = usePinia()
8+
async setup(nuxtApp) {
9+
const pinia = nuxtApp.$pinia
10+
if (!pinia) {
11+
return
12+
}
1113

1214
pinia.use(
1315
createPersistedStatePlugin({

0 commit comments

Comments
 (0)