list users
This commit is contained in:
@@ -1,19 +1,38 @@
|
||||
checkToken();
|
||||
|
||||
instance.get("users/count", { withCredentials: true }).then(function(response){
|
||||
var countTable = document.querySelectorAll("#users tbody tr").length;
|
||||
var count = response.data / countTable;
|
||||
var reste = response.data % countTable;
|
||||
var nbPages = 20;
|
||||
|
||||
instance.get("users/count", { withCredentials: true }).then(function(response){
|
||||
|
||||
var count = response.data / nbPages;
|
||||
var reste = response.data % nbPages;
|
||||
var total = 0;
|
||||
if(reste != 0){
|
||||
var total = Number.parseInt(count) + 1;
|
||||
console.log(total);
|
||||
total = Number.parseInt(count) + 1;
|
||||
}
|
||||
|
||||
if(total > 1){
|
||||
|
||||
document.getElementById("page").classList.remove("hidden");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages}}).then(function(response){
|
||||
var trTag = document.querySelector("#users tbody tr").cloneNode(true);
|
||||
listData = response.data;
|
||||
for (var i=0; i<listData.length; i++){
|
||||
if(i != 0){
|
||||
document.querySelector("#users tbody").append(trTag);
|
||||
}
|
||||
var trAll = document.querySelectorAll("#users tbody tr")
|
||||
td = trAll[i].querySelectorAll("td");
|
||||
td[0].textContent = listData[i].id;
|
||||
td[1].textContent = listData[i].pseudo
|
||||
td[2].textContent = listData[i].email
|
||||
td[3].textContent = listData[i].roles
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
instance.get("users", {withCredentials: true}).then(function(response){
|
||||
console.log(response);
|
||||
})
|
Reference in New Issue
Block a user