mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
merge onEnsureConnectUserDone method with onLocalUserDone
This commit is contained in:
parent
365240e17a
commit
f6a8b81959
@ -39,11 +39,11 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
||||
|
||||
function mergeServers(credentialProvider, list1, list2) {
|
||||
for (var i = 0, length = list2.length; i < length; i++) {
|
||||
credentialProvider.addOrUpdateServer(list1, list2[i]);
|
||||
credentialProvider.addOrUpdateServer(list1, list2[i]);
|
||||
}
|
||||
|
||||
return list1;
|
||||
}
|
||||
}
|
||||
|
||||
function updateServerInfo(server, systemInfo) {
|
||||
server.Name = systemInfo.ServerName;
|
||||
@ -573,31 +573,22 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
||||
self.user = function (apiClient) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
function onLocalUserDone(e) {
|
||||
var image = getImageUrl(localUser);
|
||||
resolve({
|
||||
localUser: localUser,
|
||||
name: localUser ? localUser.Name : null,
|
||||
imageUrl: image.url,
|
||||
supportsImageParams: image.supportsParams,
|
||||
});
|
||||
}
|
||||
|
||||
function onEnsureConnectUserDone() {
|
||||
if (apiClient && apiClient.getCurrentUserId()) {
|
||||
apiClient.getCurrentUser().then(function (u) {
|
||||
localUser = u;
|
||||
onLocalUserDone();
|
||||
var image = getImageUrl(localUser);
|
||||
resolve({
|
||||
localUser: localUser,
|
||||
name: localUser ? localUser.Name : null,
|
||||
imageUrl: image.url,
|
||||
supportsImageParams: image.supportsParams,
|
||||
});
|
||||
}, onLocalUserDone);
|
||||
} else {
|
||||
onLocalUserDone();
|
||||
}
|
||||
}
|
||||
|
||||
var localUser;
|
||||
var credentials = credentialProvider.credentials();
|
||||
|
||||
if (apiClient && apiClient.getCurrentUserId()) {
|
||||
onEnsureConnectUserDone();
|
||||
onLocalUserDone();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user