fix(web): ghetto way to decrease notified counter
This commit is contained in:
parent
a9dbe5dd9c
commit
025c80f6e2
2 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue