mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add connection response handling
This commit is contained in:
parent
e27131edf0
commit
af6d3f2e63
1 changed files with 21 additions and 16 deletions
|
@ -503,23 +503,28 @@ class AppRouter {
|
|||
const firstResult = this.firstConnectionResult;
|
||||
|
||||
this.firstConnectionResult = null;
|
||||
if (firstResult && firstResult.State === 'ServerSignIn') {
|
||||
const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public';
|
||||
fetch(url).then(response => {
|
||||
if (!response.ok) return Promise.reject('fetch failed');
|
||||
return response.json();
|
||||
}).then(data => {
|
||||
if (data !== null && data.StartupWizardCompleted === false) {
|
||||
ServerConnections.setLocalApiClient(firstResult.ApiClient);
|
||||
Dashboard.navigate('wizardstart.html');
|
||||
} else {
|
||||
this.handleConnectionResult(firstResult);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
if (firstResult) {
|
||||
if (firstResult.State === 'ServerSignIn') {
|
||||
const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public';
|
||||
fetch(url).then(response => {
|
||||
if (!response.ok) return Promise.reject('fetch failed');
|
||||
return response.json();
|
||||
}).then(data => {
|
||||
if (data !== null && data.StartupWizardCompleted === false) {
|
||||
ServerConnections.setLocalApiClient(firstResult.ApiClient);
|
||||
Dashboard.navigate('wizardstart.html');
|
||||
} else {
|
||||
this.handleConnectionResult(firstResult);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
return;
|
||||
return;
|
||||
} else if (firstResult.State !== 'SignedIn') {
|
||||
this.handleConnectionResult(firstResult);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const apiClient = ServerConnections.currentApiClient();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue