From 3de749dbea5be761e06aadc48f490404f1666160 Mon Sep 17 00:00:00 2001 From: Xylight Date: Fri, 8 Mar 2024 17:05:26 -0800 Subject: [PATCH] fix: notification icon doesnt work, #274 --- src/lib/auth.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 2fce672b..6cd3e7d8 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -373,7 +373,7 @@ const getNotificationCount = async ( } } -async function checkInboxRepeatedly() { +async function checkInbox() { if (!get(profile)) return const { user, jwt } = get(profile)! @@ -396,7 +396,14 @@ async function checkInboxRepeatedly() { user: user, })) - setTimeout(checkInboxRepeatedly, 5 * 60 * 1000) + } -checkInboxRepeatedly() +setInterval(checkInbox, 4 * 60 * 1000) + +profile.subscribe((p) => { + if (!p) return + + checkInbox() +}) +