store reset fix

This commit is contained in:
Julian Krauser 2024-09-05 16:25:25 +02:00
parent d51ca40ab6
commit 3cdc64674b
2 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,9 @@
import { getActivePinia, type Pinia, type Store } from "pinia";
interface ExtendedPinia extends Pinia {
_s: Map<string, Store>;
}
export const resetAllPiniaStores = () => {
(getActivePinia() as ExtendedPinia)?._s?.forEach((store: Store) => store.$reset());
};