function checkToken(){ instance.get("token", { withCredentials: true}) .then(function(response) { if(location.pathname == "/") { location.href="/html/users.html"; } }) .catch(function(error){ if(location.pathname != "/"){ location.href="/"; } if(error.response.status == 406){ instance.delete("token" , {withCredentials:true}).then(function(response){ location.reload(); }); } }); } function buildParam(typeInput){ var search = document.getElementById("searchUser").value; var param = ""; var listParam = ["skip"]; if(typeInput.length > 0){ listId =["inputRoles", "inputStatus", "inputPages"] for (var i=0; i 0){ if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){ param = param + "email="+search+"&"; } else if (/^[a-fA-F0-9]{24}$/.test(search)){ param = param + "id="+search+"&"; } else { param = param + "name="+search+"&"; } } else { listParam.push("email"); listParam.push("id"); listParam.push("name"); } for (var i=0; i 0){ param = param + listParam[i]+"="+query+"&"; } } return param; } function signOut(){ document.getElementById("signout").addEventListener("click", function(){ instance.delete("token" , {withCredentials:true}).then(function(response){ if(response.status == 200) { location.href="/"; } }); }); } function closeButton(){ var btnclose = document.getElementsByClassName("btn-close"); for (var i = 0; i 0){ query = location.search.split("?")[1]; var variables = query.split("&") for (var i=0; i 0){ query = location.search.split("?")[1]; var variables = query.split("&"); for (var i=0; i