1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #2665 from dmitrylyzo/fix-server-hash-change

Add connection response handling
This commit is contained in:
Bill Thornton 2021-05-26 14:59:44 -04:00 committed by GitHub
commit eb79a8e045
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -503,23 +503,28 @@ class AppRouter {
const firstResult = this.firstConnectionResult; const firstResult = this.firstConnectionResult;
this.firstConnectionResult = null; this.firstConnectionResult = null;
if (firstResult && firstResult.State === 'ServerSignIn') { if (firstResult) {
const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public'; if (firstResult.State === 'ServerSignIn') {
fetch(url).then(response => { const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public';
if (!response.ok) return Promise.reject('fetch failed'); fetch(url).then(response => {
return response.json(); if (!response.ok) return Promise.reject('fetch failed');
}).then(data => { return response.json();
if (data !== null && data.StartupWizardCompleted === false) { }).then(data => {
ServerConnections.setLocalApiClient(firstResult.ApiClient); if (data !== null && data.StartupWizardCompleted === false) {
Dashboard.navigate('wizardstart.html'); ServerConnections.setLocalApiClient(firstResult.ApiClient);
} else { Dashboard.navigate('wizardstart.html');
this.handleConnectionResult(firstResult); } else {
} this.handleConnectionResult(firstResult);
}).catch(error => { }
console.error(error); }).catch(error => {
}); console.error(error);
});
return; return;
} else if (firstResult.State !== 'SignedIn') {
this.handleConnectionResult(firstResult);
return;
}
} }
const apiClient = ServerConnections.currentApiClient(); const apiClient = ServerConnections.currentApiClient();