WebUI: migrate to fetch API

And away from mootools.

PR #22037.
This commit is contained in:
Chocobo1
2024-12-22 17:51:19 +08:00
committed by GitHub
parent 9709672b34
commit a841fe9320
34 changed files with 888 additions and 811 deletions

View File

@@ -45,21 +45,21 @@
return;
}
const hashesList = new URI().getData("hashes");
new Request({
url: "api/v2/torrents/setLocation",
method: "post",
data: {
hashes: hashesList,
location: location
},
onSuccess: () => {
fetch("api/v2/torrents/setLocation", {
method: "POST",
body: new URLSearchParams({
"hashes": new URI().getData("hashes"),
"location": location
})
})
.then(async (response) => {
if (!response.ok) {
$("error_div").textContent = await response.text();
return;
}
window.parent.qBittorrent.Client.closeFrameWindow(window);
},
onFailure: (xhr) => {
$("error_div").textContent = xhr.response;
}
}).send();
});
});
});
</script>