mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Settings fields being altered during save
(cherry picked from commit dd61480d60e067e851982b0cc98f03f752b80673) (cherry picked from commit cf42e0258656ba5c19e6e6fde4ddeb107c2d2416)
This commit is contained in:
@@ -28,6 +28,15 @@ function addApiKey(ajaxOptions) {
|
|||||||
ajaxOptions.headers['X-Api-Key'] = window.Prowlarr.apiKey;
|
ajaxOptions.headers['X-Api-Key'] = window.Prowlarr.apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addContentType(ajaxOptions) {
|
||||||
|
if (
|
||||||
|
!ajaxOptions.contentType &&
|
||||||
|
ajaxOptions.dataType === 'json' &&
|
||||||
|
(ajaxOptions.method === 'PUT' || ajaxOptions.method === 'POST')) {
|
||||||
|
ajaxOptions.contentType = 'application/json';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function createAjaxRequest(originalAjaxOptions) {
|
export default function createAjaxRequest(originalAjaxOptions) {
|
||||||
const requestXHR = new window.XMLHttpRequest();
|
const requestXHR = new window.XMLHttpRequest();
|
||||||
let aborted = false;
|
let aborted = false;
|
||||||
@@ -46,6 +55,7 @@ export default function createAjaxRequest(originalAjaxOptions) {
|
|||||||
moveBodyToQuery(ajaxOptions);
|
moveBodyToQuery(ajaxOptions);
|
||||||
addRootUrl(ajaxOptions);
|
addRootUrl(ajaxOptions);
|
||||||
addApiKey(ajaxOptions);
|
addApiKey(ajaxOptions);
|
||||||
|
addContentType(ajaxOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = $.ajax({
|
const request = $.ajax({
|
||||||
|
Reference in New Issue
Block a user