mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Restore deleteServer
This commit is contained in:
parent
0b13b0328a
commit
e7023dd51a
1 changed files with 25 additions and 0 deletions
|
@ -711,6 +711,31 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory
|
|||
};
|
||||
return self.connectToServer(server, options).catch(onFail);
|
||||
};
|
||||
|
||||
self.deleteServer = function (serverId) {
|
||||
if (!serverId) {
|
||||
throw new Error("null serverId");
|
||||
}
|
||||
|
||||
var server = credentialProvider.credentials().Servers.filter(function (s) {
|
||||
return s.Id === serverId;
|
||||
});
|
||||
server = server.length ? server[0] : null;
|
||||
return new Promise(function (resolve, reject) {
|
||||
function onDone() {
|
||||
var credentials = credentialProvider.credentials();
|
||||
credentials.Servers = credentials.Servers.filter(function (s) {
|
||||
return s.Id !== serverId;
|
||||
});
|
||||
credentialProvider.credentials(credentials);
|
||||
resolve();
|
||||
}
|
||||
|
||||
if (!server.ConnectServerId) {
|
||||
return void onDone();
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
ConnectionManager.prototype.connect = function (options) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue