mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update fetch requests
This commit is contained in:
parent
5f6d68e3b5
commit
7c3fa06651
10 changed files with 74 additions and 39 deletions
|
@ -196,7 +196,7 @@
|
|||
} else {
|
||||
fetchRequest.body = paramsToString(request.data);
|
||||
|
||||
contentType = contentType || 'application/x-www-form-urlencoded';
|
||||
contentType = contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,21 @@
|
|||
return fetch(request.url, fetchRequest);
|
||||
}
|
||||
|
||||
function paramsToString(params) {
|
||||
|
||||
var values = [];
|
||||
|
||||
for (var key in params) {
|
||||
|
||||
var value = params[key];
|
||||
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
values.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
|
||||
}
|
||||
}
|
||||
return values.join('&');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps around jQuery ajax methods to add additional info to the request.
|
||||
*/
|
||||
|
@ -407,21 +422,6 @@
|
|||
});
|
||||
};
|
||||
|
||||
function paramsToString(params) {
|
||||
|
||||
var values = [];
|
||||
|
||||
for (var key in params) {
|
||||
|
||||
var value = params[key];
|
||||
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
values.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
|
||||
}
|
||||
}
|
||||
return values.join('&');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an api url based on a handler name and query string parameters
|
||||
* @param {String} name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue