From cceda705b5c91d01f00c6a4f394189eef02c392a Mon Sep 17 00:00:00 2001 From: BlasenhauerJ Date: Thu, 23 Mar 2023 14:36:31 +0100 Subject: [PATCH] update flash count on remove --- src/ui/static/js/global.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/static/js/global.js b/src/ui/static/js/global.js index 3143d96d..97e9eb5d 100644 --- a/src/ui/static/js/global.js +++ b/src/ui/static/js/global.js @@ -205,13 +205,17 @@ class FlashMsg { } } catch (err) {} }); - //remove message after click + //remove flash message and change count window.addEventListener("click", (e) => { try { if (e.target.closest("button").hasAttribute("close-flash-message")) { + //remove logic const closeBtn = e.target.closest("button"); const flashEl = closeBtn.closest("[flash-message]"); flashEl.remove(); + //update count + this.flashCount.textContent = + document.querySelectorAll("[flash-message]").length; } } catch (err) {} });