diff --git a/allianceauth/static/allianceauth/js/refresh-notification-icon.js b/allianceauth/static/allianceauth/js/refresh-notification-icon.js index 6e3ef786..3899ae79 100644 --- a/allianceauth/static/allianceauth/js/refresh-notification-icon.js +++ b/allianceauth/static/allianceauth/js/refresh-notification-icon.js @@ -1,4 +1,4 @@ -/* global notificationUpdateSettings */ +/* global notificationUpdateSettings, fetchGet */ /** * This script refreshed the notification icon in the top menu @@ -19,22 +19,9 @@ $(() => { * Update the notification icon in the top menu */ const updateNotificationIcon = () => { - fetch(userNotificationCountViewUrl) - .then((response) => { - if (response.ok) { - return response.json(); - } - - throw new Error('Something went wrong'); - }) - .then((responseJson) => { - const unreadCount = responseJson.unread_count; - - if (unreadCount > 0) { - elementNotificationIcon.addClass('text-danger'); - } else { - elementNotificationIcon.removeClass('text-danger'); - } + fetchGet({url: userNotificationCountViewUrl}) + .then((data) => { + elementNotificationIcon.toggleClass('text-danger', data.unread_count > 0); }) .catch((error) => { console.log(`Failed to load HTMl to render notifications item. Error: ${error.message}`); diff --git a/allianceauth/templates/allianceauth/admin-status/esi_check.html b/allianceauth/templates/allianceauth/admin-status/esi_check.html index 9c7f1605..f5d04e72 100644 --- a/allianceauth/templates/allianceauth/admin-status/esi_check.html +++ b/allianceauth/templates/allianceauth/admin-status/esi_check.html @@ -8,30 +8,22 @@ diff --git a/allianceauth/templates/allianceauth/admin-status/overview.html b/allianceauth/templates/allianceauth/admin-status/overview.html index 31d4ff09..e2362565 100644 --- a/allianceauth/templates/allianceauth/admin-status/overview.html +++ b/allianceauth/templates/allianceauth/admin-status/overview.html @@ -133,34 +133,24 @@