diff --git a/assets/script.js b/assets/script.js index 7089679..ca32b4d 100644 --- a/assets/script.js +++ b/assets/script.js @@ -33,6 +33,10 @@ function handleResponse(data, successMessage, failureMessage) { }, 3000); } +async function showDashboardGreeting() { + document.getElementById("welcomeMsg").innerText = `Ahoj, ${UserInfo.FirstName}.`; +} + async function doAction(url, requestData, successMessage, failureMessage, silent = false) { try { const params = new URLSearchParams(); @@ -63,8 +67,8 @@ async function doAction(url, requestData, successMessage, failureMessage, silent } function handlePageResponse(data) { - const navbar = document.getElementById("navbar"); - const pageArea = document.getElementById("pagearea"); + const navbar = document.getElementById("navbar_container"); + const pageArea = document.getElementById("page_container"); if (data.Navigation) { navbar.innerHTML = data.Navigation; @@ -162,13 +166,16 @@ function onPageLoad(){ let currentPage = localStorage.getItem("currentPage"); if(currentSite === "home" && currentPage === "settings"){ if(document.getElementById("user-settings")){ - getUserInfo(); + populateUserInfoFields(UserInfo); } if(document.getElementById("admin-settings")){ listActivationCodes(); listUsers(); } } + if(currentSite === "home" && currentPage === "account") { + showDashboardGreeting(); + } } function navigateTo(site, page){ @@ -217,6 +224,7 @@ function login() { doLogin(email, password); refreshNavbar(); softReload(); + getUserInfo(); } async function doLogin(email, password) { @@ -320,7 +328,6 @@ function getUserInfo() { const result = doAction('/account', data, "User info retrieved Successfully!", "User info retrieval failed.", true); if (result && result.Status === "Success") { - populateUserInfoFields(result.UserInfo); UserInfo = result.UserInfo; } } diff --git a/templates/dashboard.html b/templates/dashboard.html index 80b1e75..f93b64c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,19 +1,3 @@ - - -

\ No newline at end of file