Created
August 5, 2023 13:00
-
-
Save pferreirafabricio/283b7a6ae4b96c7c72c9b259abb8a4b0 to your computer and use it in GitHub Desktop.
Revisions
-
pferreirafabricio created this gist
Aug 5, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ import { defineStore, getActivePinia } from "pinia"; const activePinia = getActivePinia(); if (!activePinia) return; Object.entries(activePinia.state.value).forEach(([storeName, state]) => { console.debug("Resetting store", storeName); const storeDefinition = defineStore(storeName, state); const store = storeDefinition(activePinia); store.$reset(); });