()
| 830 | } |
| 831 | |
| 832 | function loadUserList() { |
| 833 | // Updated path: from "/api/getUsers.php" to "/api/admin/getUsers.php" |
| 834 | fetch("/api/admin/getUsers.php", { credentials: "include" }) |
| 835 | .then(response => response.json()) |
| 836 | .then(data => { |
| 837 | // Assuming the endpoint returns an array of users. |
| 838 | const users = Array.isArray(data) ? data : (data.users || []); |
| 839 | const selectElem = document.getElementById("removeUsernameSelect"); |
| 840 | selectElem.innerHTML = ""; |
| 841 | users.forEach(user => { |
| 842 | const option = document.createElement("option"); |
| 843 | option.value = user.username; |
| 844 | option.textContent = user.username; |
| 845 | selectElem.appendChild(option); |
| 846 | }); |
| 847 | if (selectElem.options.length === 0) { |
| 848 | showToast(t('remove_user_none')); |
| 849 | closeRemoveUserModal(); |
| 850 | } |
| 851 | }) |
| 852 | .catch(() => { /* handle errors if needed */ }); |
| 853 | } |
| 854 | window.loadUserList = loadUserList; |
| 855 | |
| 856 | function initAuth() { |
no test coverage detected