ff-admin/src/helpers/piniaReset.ts

10 lines
266 B
TypeScript
Raw Normal View History

2024-09-05 16:25:25 +02:00
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());
};