Fix missing status bug for deleted party line

This commit is contained in:
pedrocx486 2025-01-28 20:24:11 -03:00
parent 2e6228128a
commit 4e9c4ecb64

View file

@ -1,6 +1,7 @@
<template>
<div class="w-screen text-center">
<input type="text" v-model="partyLineModel" placeholder="Enter Party Line" class="input input-bordered w-full max-w-xs" />
<input type="text" v-model="partyLineModel" placeholder="Enter Party Line"
class="input input-bordered w-full max-w-xs"/>
<button class="btn btn-outline btn-success" @click="joinPartyLine">Join Party Line</button>
<br/>
<p v-if="status"><small>{{ status }}</small></p>
@ -9,7 +10,7 @@
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { usePartyLineStore } from '../stores/partyLine';
import { storeToRefs } from "pinia";
import { useGetServer } from "@/composables/useGetServer.ts";
@ -21,15 +22,15 @@ const partyLineStore = usePartyLineStore();
const { partyLine, partyLineDeletedFlag, eventSource } = storeToRefs(partyLineStore);
onMounted(() => {
if (partyLineDeletedFlag.value) {
error.value = 'Party Line has been deleted by the admin';
}
watch(eventSource, () => {
if (!eventSource.value?.readyState) {
status.value = 'Not connected to any Party Lines...';
}
});
}, { immediate: true });
watch(partyLineDeletedFlag, () => {
error.value = 'Party Line has been deleted by the admin';
}, { immediate: true });
const partyLineModel = computed({
get: () => partyLineName.value ? partyLineName.value : partyLine.value,