mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
switch methods to fetch
This commit is contained in:
parent
6acc4bf69d
commit
dd09b038d5
91 changed files with 349 additions and 314 deletions
|
@ -323,7 +323,7 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) {
|
||||
return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||
|
||||
endpointInfo = info;
|
||||
});
|
||||
|
@ -351,10 +351,10 @@
|
|||
supportsAc3: AppSettings.enableChromecastAc3()
|
||||
});
|
||||
|
||||
getEndpointInfo().done(function (endpoint) {
|
||||
getEndpointInfo().then(function (endpoint) {
|
||||
|
||||
if (endpoint.IsInNetwork) {
|
||||
ApiClient.getPublicSystemInfo().done(function (info) {
|
||||
ApiClient.getPublicSystemInfo().then(function (info) {
|
||||
|
||||
message.serverAddress = info.LocalAddress;
|
||||
player.sendMessageInternal(message);
|
||||
|
@ -462,17 +462,15 @@
|
|||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
if (query.Ids && query.Ids.split(',').length == 1) {
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) {
|
||||
deferred.resolveWith(null, [
|
||||
{
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
}]);
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
|
||||
resolve({
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -523,7 +521,7 @@
|
|||
|
||||
self.play = function (options) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
|
@ -535,7 +533,7 @@
|
|||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
options.items = result.Items;
|
||||
self.playWithCommand(options, 'PlayNow');
|
||||
|
@ -550,7 +548,7 @@
|
|||
self.playWithCommand = function (options, command) {
|
||||
|
||||
if (!options.items) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
|
||||
|
||||
options.items = [item];
|
||||
self.playWithCommand(options, command);
|
||||
|
@ -580,7 +578,7 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
ApiClient.getItem(userId, id).then(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
|
@ -596,7 +594,7 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
ApiClient.getItem(userId, id).then(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue