From 32146bd8497ac367fc0df8d1cb4f768d9d1b0a6b Mon Sep 17 00:00:00 2001 From: Inverle Date: Mon, 30 Jun 2025 12:32:56 +0200 Subject: Rework #7646: `URLSearchParams` -> `JSON.stringify` (#7704) * Rework #7646: `URLSearchParams` -> `JSON.stringify` * Single quotes * Send `id` as int --- p/scripts/extra.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/p/scripts/extra.js b/p/scripts/extra.js index 2a8bb61a3..59c9453cb 100644 --- a/p/scripts/extra.js +++ b/p/scripts/extra.js @@ -238,11 +238,14 @@ function init_update_feed() { e.preventDefault(); faviconExtBtn.disabled = true; fetch(faviconExtBtn.dataset.extensionUrl, { - method: "POST", - body: new URLSearchParams({ + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=utf-8' + }, + body: JSON.stringify({ '_csrf': context.csrf, 'extAction': 'query_icon_info', - 'id': feed_update.dataset.feedId + 'id': +feed_update.dataset.feedId }), }).then(resp => { if (!resp.ok) { @@ -274,11 +277,14 @@ function init_update_feed() { el.disabled = true; }); await fetch(faviconExtBtn.dataset.extensionUrl, { - method: "POST", - body: new URLSearchParams({ + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=utf-8' + }, + body: JSON.stringify({ '_csrf': context.csrf, 'extAction': 'update_icon', - 'id': feed_update.dataset.feedId + 'id': +feed_update.dataset.feedId }), }); faviconExtBtn.form.onsubmit = null; -- cgit v1.2.3