added login checks before retrieving notification count

This commit is contained in:
kaffem 2020-08-20 16:14:07 +02:00
parent a6654ebbf7
commit c7ac8450b7

View file

@ -1,6 +1,7 @@
let __notificationCount = ''; let __notificationCount = '';
runAfterLoad(() => { runAfterLoad(() => {
retrieveLoginStatus();
__notificationCount = getNotificationCount(); __notificationCount = getNotificationCount();
displayNotificationsInTitle(); displayNotificationsInTitle();
}, ".*"); }, ".*");
@ -10,8 +11,10 @@ runAfterPathnameChange(() => {
}, ".*"); }, ".*");
function getNotificationCount() { function getNotificationCount() {
let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4]; if (isLoggedIn) {
return menuUserText.split(" ")[1] + ' '; let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4];
return menuUserText.split(" ")[1] + ' ';
}
} }
function displayNotificationsInTitle(){ function displayNotificationsInTitle(){