forked from v4l3n71n/covas-bo
variable for item
This commit is contained in:
parent
ec677a30ab
commit
6fdfc80880
@ -369,5 +369,5 @@
|
|||||||
|
|
||||||
<script src="../js/config.js"></script>
|
<script src="../js/config.js"></script>
|
||||||
<script src="../js/library.js"></script>
|
<script src="../js/library.js"></script>
|
||||||
<script src="../js/user.js"></script>
|
<script src="../js/item.js"></script>
|
||||||
</body></html>
|
</body></html>
|
@ -1,10 +1,12 @@
|
|||||||
checkToken();
|
checkToken();
|
||||||
signOut();
|
signOut();
|
||||||
closeButton();
|
closeButton();
|
||||||
|
pathURL = document.location.pathname.split("/")[document.location.pathname.split("/").length-1].split(".")[0]
|
||||||
|
|
||||||
var id = getQuery("id");
|
var id = getQuery("id");
|
||||||
|
|
||||||
if(id.length > 0){
|
if(id.length > 0){
|
||||||
instance.get("users/"+id, {withCredentials: true})
|
instance.get(pathURL + "s/"+id, {withCredentials: true})
|
||||||
.then(function(response){
|
.then(function(response){
|
||||||
var listValue = [ "id", "username", "name", "firstName", "email", "birth"];
|
var listValue = [ "id", "username", "name", "firstName", "email", "birth"];
|
||||||
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
|
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
|
||||||
@ -64,15 +66,15 @@ if(id.length > 0){
|
|||||||
switch(e.currentTarget.id){
|
switch(e.currentTarget.id){
|
||||||
case "disableUserButton":
|
case "disableUserButton":
|
||||||
httpMethod = "delete";
|
httpMethod = "delete";
|
||||||
httpUrl = "users/"+idInput;
|
httpUrl = pathURL + "s/"+idInput;
|
||||||
break;
|
break;
|
||||||
case "removeUserButton":
|
case "removeUserButton":
|
||||||
httpMethod = "delete";
|
httpMethod = "delete";
|
||||||
httpUrl = "users/"+idInput+"?remove=true";
|
httpUrl = pathURL + "s/"+idInput+"?remove=true";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
httpMethod = "patch";
|
httpMethod = "patch";
|
||||||
httpUrl = "users/"+idInput;
|
httpUrl = pathURL + "s/"+idInput;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
instance({
|
instance({
|
||||||
@ -82,7 +84,7 @@ if(id.length > 0){
|
|||||||
})
|
})
|
||||||
.then(function(response){
|
.then(function(response){
|
||||||
if(response.status == 200){
|
if(response.status == 200){
|
||||||
location.href="/html/user.html?id="+idInput;
|
location.href="/html/"+pathURL+".html?id="+idInput;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error){
|
.catch(function(error){
|
||||||
@ -140,7 +142,7 @@ if(id.length > 0){
|
|||||||
}
|
}
|
||||||
instance({
|
instance({
|
||||||
method : "put",
|
method : "put",
|
||||||
url:"users/"+document.getElementById("idUpdateInput").value,
|
url:pathURL+"s/"+document.getElementById("idUpdateInput").value,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
data: dataPut
|
data: dataPut
|
||||||
}).then(function(response){
|
}).then(function(response){
|
Loading…
x
Reference in New Issue
Block a user