added a basic way to retrieve the login status
This commit is contained in:
parent
150d6bcfbb
commit
b65b0ce29c
|
@ -1,5 +1,6 @@
|
|||
var isShiftPressed = false;
|
||||
var isCtrlPressed = false;
|
||||
var isLoggedIn = false;
|
||||
|
||||
function isHtmlElement(object) {
|
||||
return object instanceof HTMLElement;
|
||||
|
@ -22,4 +23,20 @@ function handleKeyToggle(event, isPressed) {
|
|||
} else if (event.key === 'Control') {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue