From 5fa6dff909d7e2d09d8e2804beae8c26eeda0795 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 25 Aug 2022 22:50:59 +0200 Subject: [PATCH] add updateParam --- web/js/users.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/js/users.js b/web/js/users.js index b858901..7d530a9 100644 --- a/web/js/users.js +++ b/web/js/users.js @@ -4,9 +4,12 @@ var param = {} param["nbPages"] = 20; -var search = getQuery("search"); -if(search.length > 0){ - document.getElementById("searchUser").value=search; +var listSearch = [ "email", "uuid", "search"]; +for(var i=0; i 0){ + document.getElementById("searchUser").value=search; + } } 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 aPage = document.querySelectorAll(".page-item")[newPage].querySelector("a"); 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"); if(page != 1){ @@ -132,7 +136,7 @@ document.getElementById("addUser").addEventListener("click", function(){ document.getElementById("searchUser").addEventListener("keydown", function(ev){ if(ev.key === "Enter"){ - var param = buildParam(e, ""); + var param = buildParam("", ""); location.href="/html/users.html?"+param; } });