store reset fix
This commit is contained in:
parent
d51ca40ab6
commit
3cdc64674b
2 changed files with 14 additions and 0 deletions
9
src/helpers/piniaReset.ts
Normal file
9
src/helpers/piniaReset.ts
Normal 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());
|
||||||
|
};
|
|
@ -44,6 +44,8 @@ import { RouterLink } from "vue-router";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
import FailureXMark from "@/components/FailureXMark.vue";
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { getActivePinia } from "pinia";
|
||||||
|
import { resetAllPiniaStores } from "../helpers/piniaReset";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -54,6 +56,9 @@ export default defineComponent({
|
||||||
loginError: "" as string,
|
loginError: "" as string,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
resetAllPiniaStores();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
login(e: any) {
|
login(e: any) {
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
|
|
Loading…
Reference in a new issue