autoload user info
This commit is contained in:
@@ -41,17 +41,29 @@
|
||||
doAccountAction(data, "Email update Successful!", "Email update failed.");
|
||||
}
|
||||
|
||||
function populateUserInfoFields(userData) {
|
||||
document.getElementById("updateFirstName").value = userData.first_name || "";
|
||||
document.getElementById("updateLastName").value = userData.last_name || "";
|
||||
document.getElementById("updateNickname").value = userData.nickname || "";
|
||||
document.getElementById("updateMinecraftNick").value = userData.minecraft_nick || "";
|
||||
document.getElementById("updateNewEmail").value = userData.Email || "";
|
||||
}
|
||||
|
||||
async function getUserInfo() {
|
||||
const data = new URLSearchParams();
|
||||
data.append("action", "get_user_info");
|
||||
|
||||
const result = await doAccountAction(data, "User info retrieved Successfully!", "User info retrieval failed.");
|
||||
const result = await doAccountAction(data, "User info retrieved Successfully!", "User info retrieval failed.", true);
|
||||
|
||||
if (result && result.Status === "Success") {
|
||||
displayUserInfo(result.UserInfo);
|
||||
populateUserInfoFields(result.UserInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function init(){
|
||||
getUserInfo();
|
||||
}
|
||||
|
||||
function displayUserInfo(userData) {
|
||||
const tableContainer = document.getElementById("userInfoTable");
|
||||
tableContainer.innerHTML = ""; // Clear previous content
|
||||
@@ -75,6 +87,7 @@
|
||||
|
||||
tableContainer.appendChild(table);
|
||||
}
|
||||
window.onload = init();
|
||||
</script>
|
||||
|
||||
<!-- Centralized Status Message -->
|
||||
|
Reference in New Issue
Block a user