fix(FE): life cycle hook

This commit is contained in:
Michael 2025-04-15 10:26:52 +02:00
parent acd6f547ad
commit c6f2e2d1b8

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import {computed, onMounted, onBeforeUnmount, ref} from "vue";
import {computed, onActivated, onDeactivated, ref} from "vue";
import {useAuthStore} from "@/stores/auth.store.ts";
import {deleteShow} from "@models/show/show.ts";
import {baseShowInstance, deleteShowInstance, getShowInstances} from "@models/show/showInstance.ts";
@ -76,7 +76,7 @@ const goBack = async () => {
// so reducing the network calls sent
// That requires the handling of the context menu
// and the show/instance id in a different way though
onMounted(async () => {
onActivated(async () => {
await triggerFetchShowInstances(new Date());
intervalId = setInterval(async () => {
if (!isRunning.value) {
@ -85,7 +85,7 @@ onMounted(async () => {
}, 1000);
});
onBeforeUnmount(() => {
onDeactivated(() => {
clearInterval(intervalId);
});
</script>