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;
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();