Move schedule edit delete to API call

This commit is contained in:
amcmanu3 2023-03-04 18:19:30 -05:00
parent 8ac0449bcb
commit addd878942

View File

@ -286,22 +286,20 @@
}
}
function del_task(sch_id, id) {
var token = getCookie("_xsrf")
async function del_task(sch_id, id) {
var token = getCookie("_xsrf")
$.ajax({
type: "DELETE",
headers: { 'X-XSRFToken': token },
url: '/ajax/del_task?server_id=' + id + '&schedule_id=' + sch_id,
data: {
schedule_id: sch_id,
id: id
},
success: function (data) {
location.reload();
},
});
let res = await fetch(`/api/v2/servers/${id}/tasks/${sch_id}`, {
method: 'DELETE',
headers: {
'token': token,
},
});
let responseData = await res;
if (responseData.statusText === "OK") {
window.location.reload();
}
}
function startup() {
try {
document.getElementById("{{ data['schedule']['interval_type'] }}").setAttribute('selected', true);