✏️ 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,13 +39,17 @@ 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) {
snacks.value.push({ if (
snack: true, snacks.value.filter((value) => value.text == event?.text).length == 0
text: event.text, ) {
color: event.type, snacks.value.push({
uuid: event.uuid, snack: true,
icon: getIcon(event.type), text: event.text,
}); color: event.type,
uuid: event.uuid,
icon: getIcon(event.type),
});
}
} }
} }
}); });
@ -64,13 +68,15 @@ watch(
if (eventQueuStore.size != 0) { if (eventQueuStore.size != 0) {
let event = eventQueuStore.shift(); let event = eventQueuStore.shift();
if (event?.uuid) { if (event?.uuid) {
snacks.value.push({ if (snacks.value.filter((value) => value.text == event?.text).length == 0) {
snack: true, snacks.value.push({
text: event.text, snack: true,
color: event.type, text: event.text,
uuid: event.uuid, color: event.type,
icon: getIcon(event.type), uuid: event.uuid,
}); icon: getIcon(event.type),
});
}
} }
} }