change param

This commit is contained in:
Valentin CZERYBA 2023-10-21 21:42:01 +02:00
parent 319ba75d43
commit acd1b36eb0

View File

@ -2,7 +2,7 @@ checkToken();
signOut(); signOut();
var param = {} var param = {}
param["nbPages"] = 20; param["limit"] = 20;
var listSearch = [ "email", "uuid", "search"]; var listSearch = [ "email", "uuid", "search"];
for(var i=0; i<listSearch.length; i++){ for(var i=0; i<listSearch.length; i++){
@ -30,8 +30,8 @@ for (var i=0; i<listQuery.length; i++){
instance.get("users/count", { withCredentials: true }).then(function(response){ instance.get("users/count", { withCredentials: true }).then(function(response){
var count = response.data["count"] / param["nbPages"]; var count = response.data["count"] / param["limit"];
var reste = response.data["count"] % param["nbPages"]; var reste = response.data["count"] % param["limit"];
var total = 0; var total = 0;
if(reste != 0){ if(reste != 0){
total = Number.parseInt(count) + 1; total = Number.parseInt(count) + 1;
@ -39,7 +39,7 @@ instance.get("users/count", { withCredentials: true }).then(function(response){
if(total > 1){ if(total > 1){
document.getElementById("page").classList.remove("hidden"); document.getElementById("page").classList.remove("hidden");
var pageCurrent = getQuery("page"); var pageCurrent = getQuery("skip");
var page = 1; var page = 1;
if(pageCurrent.length > 0){ if(pageCurrent.length > 0){
page = Number.parseInt(pageCurrent); page = Number.parseInt(pageCurrent);
@ -68,11 +68,11 @@ instance.get("users/count", { withCredentials: true }).then(function(response){
}); });
param["page"] = 0; param["skip"] = 0;
var pageCurrent = getQuery("page"); var pageCurrent = getQuery("skip");
if (pageCurrent.length > 0){ if (pageCurrent.length > 0){
param["page"] = Number.parseInt(pageCurrent); param["skip"] = Number.parseInt(pageCurrent);
param["page"] = param["page"] - 1; param["skip"] = param["skip"] - 1;
} }
var listQuery = ["search", "uuid", "roles", "status", "email"]; var listQuery = ["search", "uuid", "roles", "status", "email"];