fix(web): ghetto way to decrease notified counter

This commit is contained in:
əlemi 2025-01-09 17:03:08 +01:00
parent a9dbe5dd9c
commit 025c80f6e2
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 3 additions and 0 deletions

View file

@ -115,6 +115,7 @@ pub fn Item(
#[component]
fn AckBtn(id: String, tx: WriteSignal<bool>) -> impl IntoView {
let auth = use_context::<Auth>().expect("missing auth context");
let (notifications, set_notifications) = use_context::<(ReadSignal<u64>, WriteSignal<u64>)>().expect("missing notifications context");
view! {
<span
@ -129,6 +130,7 @@ fn AckBtn(id: String, tx: WriteSignal<bool>) -> impl IntoView {
tracing::error!("failed marking notification as seen: {e}");
} else {
tx.set(false);
set_notifications.set(notifications.get() - 1);
}
});
}

View file

@ -137,6 +137,7 @@ pub fn App() -> impl IntoView {
});
fetch_notifications();
set_interval(fetch_notifications, std::time::Duration::from_secs(60));
provide_context((notifications, set_notifications));
view! {
<nav class="w-100 mt-1 mb-1 pb-s">