adapt search for endpoint

This commit is contained in:
Valentin CZERYBA 2023-10-30 23:41:58 +01:00
parent 52eff81bf1
commit e590b3f823
2 changed files with 8 additions and 10 deletions

View File

@ -31,19 +31,19 @@ function buildParam(e, id){
if(id == "inputRoles"){
var status = e.target.value;
if(status != "-2"){
param = param + "key=status&value="+status+"&";
param = param + "status="+status+"&";
}
if(getId != "All"){
param = param + "key=roles&value="+getId;
param = param + "roles="+getId;
}
}
if(id == "inputStatus"){
var roles = e.target.value;
if(getId != "-2"){
param = param + "key=status&value="+getId+"&";
param = param + "status="+getId+"&";
}
if(roles != "All"){
param = param + "key=roles&value="+roles+"&";
param = param + "roles="+roles+"&";
}
}
} else {
@ -54,13 +54,11 @@ function buildParam(e, id){
if(search.length > 0){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){
param = param + "email="+search+"&";
} else if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(search)){
param = param + "uuid="+search+"&";
} else {
param = param + "search="+search+"&";
param = param + "id="+search+"&";
}
} else {
listParam.push("email"); listParam.push("uuid"); listParam.push("search");
listParam.push("email"); listParam.push("id");
}
for (var i=0; i<listParam.length; i++){

View File

@ -75,7 +75,7 @@ if (pageCurrent.length > 0){
param["skip"] = param["skip"] - 1;
}
var listQuery = ["search", "uuid", "roles", "status", "email"];
var listQuery = ["search", "id", "roles", "status", "email"];
for (var i=0; i<listQuery.length; i++){
var query = getQuery(listQuery[i]);
if(query.length > 0){
@ -83,7 +83,7 @@ for (var i=0; i<listQuery.length; i++){
}
}
instance.get("users", {withCredentials: true, params :param}).then(function(response){
instance.get("users", {withCredentials: true, params:param}).then(function(response){
var listData = response.data;
if(!Array.isArray(listData)){
var listData = []