1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

merge onEnsureConnectUserDone method with onLocalUserDone

This commit is contained in:
grafixeyehero 2019-10-29 00:29:28 +03:00
parent 365240e17a
commit f6a8b81959

View file

@ -573,6 +573,9 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
self.user = function (apiClient) {
return new Promise(function (resolve, reject) {
function onLocalUserDone(e) {
if (apiClient && apiClient.getCurrentUserId()) {
apiClient.getCurrentUser().then(function (u) {
localUser = u;
var image = getImageUrl(localUser);
resolve({
localUser: localUser,
@ -580,24 +583,12 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
imageUrl: image.url,
supportsImageParams: image.supportsParams,
});
}
function onEnsureConnectUserDone() {
if (apiClient && apiClient.getCurrentUserId()) {
apiClient.getCurrentUser().then(function (u) {
localUser = u;
onLocalUserDone();
}, onLocalUserDone);
} else {
onLocalUserDone();
}
}
var localUser;
var credentials = credentialProvider.credentials();
if (apiClient && apiClient.getCurrentUserId()) {
onEnsureConnectUserDone();
onLocalUserDone();
}
});
};