added a basic way to retrieve the login status

This commit is contained in:
kaffem 2020-08-20 16:04:58 +02:00
parent 150d6bcfbb
commit b65b0ce29c

View file

@ -1,5 +1,6 @@
var isShiftPressed = false; var isShiftPressed = false;
var isCtrlPressed = false; var isCtrlPressed = false;
var isLoggedIn = false;
function isHtmlElement(object) { function isHtmlElement(object) {
return object instanceof HTMLElement; return object instanceof HTMLElement;
@ -23,3 +24,19 @@ function handleKeyToggle(event, isPressed) {
isCtrlPressed = isPressed; isCtrlPressed = isPressed;
} }
} }
function retrieveLoginStatus() {
let menu = document.getElementById('materialize-menu-dropdown');
let menuItem = menu.innerText.split('\n')[4];
if (menuItem === 'Login') {
isLoggedIn = false;
console.log(isLoggedIn);
}
else if (menuItem.includes('User')) {
isLoggedIn = true;
console.log(isLoggedIn);
}
else {
console.error("Something went wrong, couldn't retrieve login status.");
}
}