This commit is contained in:
johan 2023-01-10 09:51:15 +01:00
parent 26c0a7b372
commit c6ca4bf4c6

View file

@ -266,7 +266,8 @@ function get_admin(type) {
<div id="switch-state">${text}</div>
</span>
</span>
`)
`);
refreshListener();
}
}
});
@ -381,27 +382,6 @@ function get_admin(type) {
}
function refreshListener() {
$('#switch-state').click(() => {
$.ajax({
type: "POST",
url: base_url + "switchState",
data: JSON.stringify({
uid: localStorage.getItem('user'),
token: localStorage.getItem('token'),
}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
if(data.state == 'open') {
$("#switch-state").text('Vérouiller');
} else {
$("#switch-state").text('Dévérouiller');
}
}
})
});
$(".prank-btn-accept").click((e) => {
let uid = e.target.parentNode.parentNode.id
@ -671,6 +651,26 @@ function refreshListener() {
$('.overlay').css({"opacity": 1, "visibility": "visible"});
});
$('#switch-state').click((e) => {
$.ajax({
type: "POST",
url: base_url + "switchState",
data: JSON.stringify({
uid: localStorage.getItem('user'),
token: localStorage.getItem('token'),
}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
if(data.state == 'open') {
$("#switch-state").text('Vérouiller');
} else {
$("#switch-state").text('Dévérouiller');
}
}
});
});
}
$('.close').click((e) => {