Fix missing status bug for deleted party line
This commit is contained in:
parent
2e6228128a
commit
4e9c4ecb64
1 changed files with 9 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="w-screen text-center">
|
<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>
|
<button class="btn btn-outline btn-success" @click="joinPartyLine">Join Party Line</button>
|
||||||
<br/>
|
<br/>
|
||||||
<p v-if="status"><small>{{ status }}</small></p>
|
<p v-if="status"><small>{{ status }}</small></p>
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { usePartyLineStore } from '../stores/partyLine';
|
import { usePartyLineStore } from '../stores/partyLine';
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useGetServer } from "@/composables/useGetServer.ts";
|
import { useGetServer } from "@/composables/useGetServer.ts";
|
||||||
|
@ -21,15 +22,15 @@ const partyLineStore = usePartyLineStore();
|
||||||
|
|
||||||
const { partyLine, partyLineDeletedFlag, eventSource } = storeToRefs(partyLineStore);
|
const { partyLine, partyLineDeletedFlag, eventSource } = storeToRefs(partyLineStore);
|
||||||
|
|
||||||
onMounted(() => {
|
watch(eventSource, () => {
|
||||||
if (partyLineDeletedFlag.value) {
|
|
||||||
error.value = 'Party Line has been deleted by the admin';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eventSource.value?.readyState) {
|
if (!eventSource.value?.readyState) {
|
||||||
status.value = 'Not connected to any Party Lines...';
|
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({
|
const partyLineModel = computed({
|
||||||
get: () => partyLineName.value ? partyLineName.value : partyLine.value,
|
get: () => partyLineName.value ? partyLineName.value : partyLine.value,
|
||||||
|
|
Loading…
Add table
Reference in a new issue