Skip to content

Commit ac0f4ea

Browse files
committed
WebUI: migrate to fetch API
This is the final part of it.
1 parent 7487cd7 commit ac0f4ea

15 files changed

+626
-551
lines changed

src/webui/www/private/rename_files.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@
267267
}
268268
setupTable(selectedRows);
269269
};
270-
fileRenamer.onRenameError = (err, row) => {
271-
if (err.xhr.status === 409)
270+
fileRenamer.onRenameError = (response, row) => {
271+
if (response.status === 409)
272272
$("rename_error").textContent = `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``;
273273
};
274274
$("renameOptions").addEventListener("change", (e) => {
@@ -379,7 +379,11 @@
379379
};
380380

381381
const setupTable = (selectedRows) => {
382-
fetch(new URI("api/v2/torrents/files").setData("hash", data.hash), {
382+
const url = new URL("api/v2/torrents/files", window.location);
383+
url.search = new URLSearchParams({
384+
hash: data.hash
385+
});
386+
fetch(url, {
383387
method: "GET",
384388
cache: "no-store"
385389
})

src/webui/www/private/scripts/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,11 @@ window.addEventListener("DOMContentLoaded", () => {
749749
let syncRequestInProgress = false;
750750
const syncMainData = () => {
751751
syncRequestInProgress = true;
752-
fetch(new URI("api/v2/sync/maindata").setData("rid", syncMainDataLastResponseId), {
752+
const url = new URL("api/v2/sync/maindata", window.location);
753+
url.search = new URLSearchParams({
754+
rid: syncMainDataLastResponseId
755+
});
756+
fetch(url, {
753757
method: "GET",
754758
cache: "no-store"
755759
})

0 commit comments

Comments
 (0)