mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-12-26 06:30:21 +00:00
Handle parameters more gracefully with the mixin. (#198)
This commit is contained in:
@@ -55,7 +55,12 @@ const mixin = {
|
||||
num = parseInt(num)
|
||||
return num.toLocaleString('en-US')
|
||||
},
|
||||
fetchJson: function (url, options) {
|
||||
fetchJson: function (url, params, options) {
|
||||
if (params) {
|
||||
url = new URL(url);
|
||||
for (var param in params)
|
||||
url.searchParams.set(param, params[param])
|
||||
}
|
||||
return fetch(url, options).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user