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());
};

View file

@ -44,6 +44,8 @@ import { RouterLink } from "vue-router";
import Spinner from "@/components/Spinner.vue";
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
import FailureXMark from "@/components/FailureXMark.vue";
import { getActivePinia } from "pinia";
import { resetAllPiniaStores } from "../helpers/piniaReset";
</script>
<script lang="ts">
@ -54,6 +56,9 @@ export default defineComponent({
loginError: "" as string,
};
},
mounted() {
resetAllPiniaStores();
},
methods: {
login(e: any) {
let formData = e.target.elements;