diff options
Diffstat (limited to 'web_src/js/features/notification.js')
-rw-r--r-- | web_src/js/features/notification.js | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js index f4c31c5ede..1e483b16c8 100644 --- a/web_src/js/features/notification.js +++ b/web_src/js/features/notification.js @@ -3,21 +3,22 @@ const {appSubUrl, csrfToken, notificationSettings} = window.config; let notificationSequenceNumber = 0; export function initNotificationsTable() { - $('#notification_table .button').on('click', async function () { - const data = await updateNotification( - $(this).data('url'), - $(this).data('status'), - $(this).data('page'), - $(this).data('q'), - $(this).data('notification-id'), - ); - - if ($(data).data('sequence-number') === notificationSequenceNumber) { - $('#notification_div').replaceWith(data); - initNotificationsTable(); - } - await updateNotificationCount(); - + $('#notification_table .button').on('click', function () { + (async () => { + const data = await updateNotification( + $(this).data('url'), + $(this).data('status'), + $(this).data('page'), + $(this).data('q'), + $(this).data('notification-id'), + ); + + if ($(data).data('sequence-number') === notificationSequenceNumber) { + $('#notification_div').replaceWith(data); + initNotificationsTable(); + } + await updateNotificationCount(); + })(); return false; }); } @@ -104,8 +105,8 @@ export function initNotificationCount() { } const fn = (timeout, lastCount) => { - setTimeout(async () => { - await updateNotificationCountWithCallback(fn, timeout, lastCount); + setTimeout(() => { + const _promise = updateNotificationCountWithCallback(fn, timeout, lastCount); }, timeout); }; |