WebUI: migrate to fetch API

This is the final part of it.

PR #22072.
This commit is contained in:
Chocobo1
2024-12-29 15:44:28 +08:00
committed by GitHub
parent e740a42366
commit 9c0475ebfa
15 changed files with 626 additions and 551 deletions

View File

@@ -88,7 +88,11 @@ window.qBittorrent.PropGeneral ??= (() => {
return;
}
fetch(new URI("api/v2/torrents/properties").setData("hash", current_id), {
const propertiesURL = new URL("api/v2/torrents/properties", window.location);
propertiesURL.search = new URLSearchParams({
hash: current_id
});
fetch(propertiesURL, {
method: "GET",
cache: "no-store"
})
@@ -230,7 +234,11 @@ window.qBittorrent.PropGeneral ??= (() => {
loadTorrentDataTimer = loadTorrentData.delay(5000);
});
fetch(new URI("api/v2/torrents/pieceStates").setData("hash", current_id), {
const pieceStatesURL = new URL("api/v2/torrents/pieceStates", window.location);
pieceStatesURL.search = new URLSearchParams({
hash: current_id
});
fetch(pieceStatesURL, {
method: "GET",
cache: "no-store"
})