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