List of roles in the users

This commit is contained in:
Dita Aji Pratama 2025-08-13 07:27:21 +07:00
parent 99bd1844a8
commit 7676fb2813

View File

@ -34,6 +34,22 @@ sendHttpRequest("/api/auth/users/list", "POST", null,
}, "application/json", `Bearer ${token}`
);
sendHttpRequest("/api/auth/roles/list", "POST", null,
function (error, response) {
if (error) console.error("Error:", error);
else {
console.log("JSON Response:", response);
const ls = JSON.parse(response);
ls.data.forEach(row => {
const itemElement = document.createElement("div");
itemElement.innerHTML = `<label><input type="checkbox" name="roles" value="${row.id}">${row.name}</label>`;
listerRoles.appendChild(itemElement);
});
}
}, "application/json", `Bearer ${token}`
);
function invite() {
const checkedRoles = Array
.from(document.querySelectorAll('input[name="roles"]:checked'))