Files
auth_service/src/web/js/get_all_users.js
T
wt 3a1f97e078
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
adde bootstrap
2025-04-23 12:23:34 +07:00

24 lines
1.0 KiB
JavaScript

const get_all_users = async () => {
const response = await fetch(routes.all_users(), {
method: "POST",
body: `{"token":"${localStorage.getItem("token")}"}`
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
notification(`Ошибка на сервере: ${error}`, "error")
})
const alluserstablebody = document.querySelector('#alluserstablebody')
alluserstablebody.innerHTML = ""
for (const user of response) {
alluserstablebody.innerHTML += `
<tr>
<th><p>${user.id}</p></th>
<th>${user.username}</th>
<th>${user.group}</th>
<th>${user.is_superuser}</th>
<th><button class="deleteuser btn btn-danger" id="${user.id}">Delete</button></th>
<th><button class="changepassword btn btn-warning" id="${user.id}">Change password</button></th>
<th><button class="changeuser btn btn-warning" id="${user.id}">Change user data</button></th>
</tr>
`
}
}