diff options
Diffstat (limited to 'profile/public/users.js')
-rw-r--r-- | profile/public/users.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/profile/public/users.js b/profile/public/users.js index 0f3700a..77bc85c 100644 --- a/profile/public/users.js +++ b/profile/public/users.js @@ -1,9 +1,10 @@ function addUser(user) { - const div = document.createElement("div"); - // Idk what to do lel + const li = document.createElement("li"); + li.textContent = `${user.name} ${user.middlename || ""} ${user.surname}`; + li.addEventListener("click", () => window.location.assign(`./user.html?uid=${user.id}`)); + document.getElementById("class_" + user.class_id).appendChild(li); } -fetch("api/users") +fetch("/auth/api/list?class=all") .then((response) => response.json()) - .then((response) => response.forEach(addUser)) - .catch(console.error); + .then((response) => response.forEach(addUser)); |