mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove global ApiClient reference
This commit is contained in:
parent
adb22abdc2
commit
d52c56eb2e
2 changed files with 27 additions and 11 deletions
|
@ -104,6 +104,18 @@ class ServerConnections extends ConnectionManager {
|
|||
return apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ApiClient that is currently connected or throws if not defined.
|
||||
* @async
|
||||
* @returns {Promise<ApiClient>} The current ApiClient instance.
|
||||
*/
|
||||
async getCurrentApiClientAsync() {
|
||||
const apiClient = this.currentApiClient();
|
||||
if (!apiClient) throw new Error('[ServerConnection] No current ApiClient instance');
|
||||
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
onLocalUserSignedIn(user) {
|
||||
const apiClient = this.getApiClient(user.ServerId);
|
||||
this.setLocalApiClient(apiClient);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue