add updateParam

This commit is contained in:
Valentin CZERYBA 2022-08-25 22:50:59 +02:00
parent d39f5921be
commit 5fa6dff909

View File

@ -4,10 +4,13 @@ var param = {}
param["nbPages"] = 20; param["nbPages"] = 20;
var search = getQuery("search"); var listSearch = [ "email", "uuid", "search"];
for(var i=0; i<listSearch.length; i++){
var search = getQuery(listSearch[i]);
if(search.length > 0){ if(search.length > 0){
document.getElementById("searchUser").value=search; document.getElementById("searchUser").value=search;
} }
}
var listQuery = [{"query": "roles", "id":"inputRoles"}, {"query":"status", "id":"inputStatus"}] var listQuery = [{"query": "roles", "id":"inputRoles"}, {"query":"status", "id":"inputStatus"}]
@ -50,7 +53,8 @@ instance.get("users/count", { withCredentials: true }).then(function(response){
var newPage = i + 2; var newPage = i + 2;
var aPage = document.querySelectorAll(".page-item")[newPage].querySelector("a"); var aPage = document.querySelectorAll(".page-item")[newPage].querySelector("a");
aPage.text=newPage; aPage.text=newPage;
aPage.href="/html/users.html?page="+newPage; var newPage = updateParam("page", newpage);
aPage.href="/html/users.html?"+newPage;
} }
document.querySelectorAll(".page-item")[page].classList.add("active"); document.querySelectorAll(".page-item")[page].classList.add("active");
if(page != 1){ if(page != 1){
@ -132,7 +136,7 @@ document.getElementById("addUser").addEventListener("click", function(){
document.getElementById("searchUser").addEventListener("keydown", function(ev){ document.getElementById("searchUser").addEventListener("keydown", function(ev){
if(ev.key === "Enter"){ if(ev.key === "Enter"){
var param = buildParam(e, ""); var param = buildParam("", "");
location.href="/html/users.html?"+param; location.href="/html/users.html?"+param;
} }
}); });