Skip to content
Snippets Groups Projects
Commit e4d72b8f authored by VISHESH0932's avatar VISHESH0932
Browse files

Modified getUserName function

parent 5a145b7e
Branches
No related tags found
1 merge request!143EXTERN: MR 116 Changes
......@@ -53,9 +53,15 @@ function isAuthenticated() {
* @return Name of the user.
*/
function getUserName() {
return document.getElementsByClassName("caosdb-user-name")[0].innerText;
const userElement = document.getElementsByClassName("caosdb-user-name")[0];
if (userElement) {
return userElement.innerText;
} else {
throw new Error("No user is logged in.");
}
}
/**
* Return the realm of the user currently logged in.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment