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:
parent
365240e17a
commit
f6a8b81959
1 changed files with 10 additions and 19 deletions
|
@ -573,6 +573,9 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
||||||
self.user = function (apiClient) {
|
self.user = function (apiClient) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
function onLocalUserDone(e) {
|
function onLocalUserDone(e) {
|
||||||
|
if (apiClient && apiClient.getCurrentUserId()) {
|
||||||
|
apiClient.getCurrentUser().then(function (u) {
|
||||||
|
localUser = u;
|
||||||
var image = getImageUrl(localUser);
|
var image = getImageUrl(localUser);
|
||||||
resolve({
|
resolve({
|
||||||
localUser: localUser,
|
localUser: localUser,
|
||||||
|
@ -580,24 +583,12 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
||||||
imageUrl: image.url,
|
imageUrl: image.url,
|
||||||
supportsImageParams: image.supportsParams,
|
supportsImageParams: image.supportsParams,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function onEnsureConnectUserDone() {
|
|
||||||
if (apiClient && apiClient.getCurrentUserId()) {
|
|
||||||
apiClient.getCurrentUser().then(function (u) {
|
|
||||||
localUser = u;
|
|
||||||
onLocalUserDone();
|
|
||||||
}, onLocalUserDone);
|
}, onLocalUserDone);
|
||||||
} else {
|
|
||||||
onLocalUserDone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var localUser;
|
var localUser;
|
||||||
var credentials = credentialProvider.credentials();
|
|
||||||
|
|
||||||
if (apiClient && apiClient.getCurrentUserId()) {
|
if (apiClient && apiClient.getCurrentUserId()) {
|
||||||
onEnsureConnectUserDone();
|
onLocalUserDone();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue