Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
update connection
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Mar 29, 2018
1 parent 2fffd6d commit a2ebae6
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions connectionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,30 +567,7 @@ export default class ConnectionManager {
}).then(systemInfo => {

updateServerInfo(server, systemInfo);

if (server.UserId) {

return ajax({
type: "GET",
url: getEmbyServerUrl(url, `users/${server.UserId}`),
dataType: "json",
headers: {
"X-MediaBrowser-Token": server.AccessToken
}

}).then(user => {

return onLocalUserSignIn(server, connectionMode, user);

}, () => {

server.UserId = null;
server.AccessToken = null;
return Promise.resolve();
});
} else {
return Promise.resolve();
}
return Promise.resolve();

}, () => {

Expand Down Expand Up @@ -1096,13 +1073,22 @@ export default class ConnectionManager {

result.ApiClient.updateServerInfo(server, connectionMode);

const resolveActions = function () {
resolve(result);

events.trigger(self, 'connected', [result]);
};

if (result.State === 'SignedIn') {
afterConnected(result.ApiClient, options);
}

resolve(result);

events.trigger(self, 'connected', [result]);
result.ApiClient.getCurrentUser().then(function (user) {
onLocalUserSignIn(server, connectionMode, user).then(resolveActions, resolveActions);
}, resolveActions);
}
else {
resolveActions();
}
}

self.connectToAddress = function (address, options) {
Expand Down

0 comments on commit a2ebae6

Please sign in to comment.