✏️ Prevent mutiple messages

This commit is contained in:
SebClem 2022-06-24 17:48:14 +02:00
parent 9a8f1b112a
commit be82cc4aa1
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -39,6 +39,9 @@ eventQueuStore.$subscribe((mutation, state) => {
if (state.events.length != 0) { if (state.events.length != 0) {
let event = eventQueuStore.shift(); let event = eventQueuStore.shift();
if (event?.uuid) { if (event?.uuid) {
if (
snacks.value.filter((value) => value.text == event?.text).length == 0
) {
snacks.value.push({ snacks.value.push({
snack: true, snack: true,
text: event.text, text: event.text,
@ -48,6 +51,7 @@ eventQueuStore.$subscribe((mutation, state) => {
}); });
} }
} }
}
}); });
watch( watch(
@ -64,6 +68,7 @@ watch(
if (eventQueuStore.size != 0) { if (eventQueuStore.size != 0) {
let event = eventQueuStore.shift(); let event = eventQueuStore.shift();
if (event?.uuid) { if (event?.uuid) {
if (snacks.value.filter((value) => value.text == event?.text).length == 0) {
snacks.value.push({ snacks.value.push({
snack: true, snack: true,
text: event.text, text: event.text,
@ -72,6 +77,7 @@ if (eventQueuStore.size != 0) {
icon: getIcon(event.type), icon: getIcon(event.type),
}); });
} }
}
} }
function getIcon(type: string) { function getIcon(type: string) {