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
|
@ -39,11 +39,11 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
||||||
|
|
||||||
function mergeServers(credentialProvider, list1, list2) {
|
function mergeServers(credentialProvider, list1, list2) {
|
||||||
for (var i = 0, length = list2.length; i < length; i++) {
|
for (var i = 0, length = list2.length; i < length; i++) {
|
||||||
credentialProvider.addOrUpdateServer(list1, list2[i]);
|
credentialProvider.addOrUpdateServer(list1, list2[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list1;
|
return list1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateServerInfo(server, systemInfo) {
|
function updateServerInfo(server, systemInfo) {
|
||||||
server.Name = systemInfo.ServerName;
|
server.Name = systemInfo.ServerName;
|
||||||
|
@ -573,31 +573,22 @@ 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) {
|
||||||
var image = getImageUrl(localUser);
|
|
||||||
resolve({
|
|
||||||
localUser: localUser,
|
|
||||||
name: localUser ? localUser.Name : null,
|
|
||||||
imageUrl: image.url,
|
|
||||||
supportsImageParams: image.supportsParams,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onEnsureConnectUserDone() {
|
|
||||||
if (apiClient && apiClient.getCurrentUserId()) {
|
if (apiClient && apiClient.getCurrentUserId()) {
|
||||||
apiClient.getCurrentUser().then(function (u) {
|
apiClient.getCurrentUser().then(function (u) {
|
||||||
localUser = u;
|
localUser = u;
|
||||||
onLocalUserDone();
|
var image = getImageUrl(localUser);
|
||||||
|
resolve({
|
||||||
|
localUser: localUser,
|
||||||
|
name: localUser ? localUser.Name : null,
|
||||||
|
imageUrl: image.url,
|
||||||
|
supportsImageParams: image.supportsParams,
|
||||||
|
});
|
||||||
}, 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