Skip to content

Commit 8067fbd

Browse files
ResetPlugin
1 parent a8b812f commit 8067fbd

File tree

7 files changed

+152
-75
lines changed

7 files changed

+152
-75
lines changed

package-lock.json

Lines changed: 110 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
"@vueuse/components": "13.1.0",
5454
"@vueuse/nuxt": "13.1.0",
5555
"ajv": "8.17.1",
56-
"get-port-please": "^3.2.0",
56+
"get-port-please": "3.2.0",
5757
"is-electron": "2.2.2",
5858
"js-file-download": "0.4.12",
5959
"nuxt": "3.13.2",
60-
"pidtree": "^0.6.0",
61-
"pinia": "2.3.1",
60+
"pidtree": "0.6.0",
61+
"pinia": "3.0.3",
6262
"sass": "1.87.0",
6363
"semver": "7.7.1",
6464
"uuid": "11.1.0",

plugins/reset_plugin.client.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function ResetPlugin({ store, pinia }) {
2+
const initialState = JSON.parse(JSON.stringify(store.$state))
3+
store.$reset = () => {
4+
store.$patch(JSON.parse(JSON.stringify(initialState)))
5+
}
6+
}
7+
8+
export default defineNuxtPlugin(async (nuxtApp) => {
9+
nuxtApp.$pinia.use(ResetPlugin())
10+
})
11+
12+
console.log("PINIA RESET PLUGIN")

0 commit comments

Comments
 (0)