Feature/improve Ghostfolio data provider status check (#4735)

* Improve Ghostfolio data provider status check
This commit is contained in:
Thomas Kaul 2025-05-23 13:31:22 +01:00 committed by GitHub
parent 0ea588315a
commit 6e67520b68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,29 +146,35 @@ export class AdminSettingsComponent implements OnDestroy, OnInit {
this.dataSource = new MatTableDataSource(filteredProviders);
this.adminService
.fetchGhostfolioDataProviderStatus(
settings[PROPERTY_API_KEY_GHOSTFOLIO] as string
)
.pipe(
catchError(() => {
this.isGhostfolioApiKeyValid = false;
const ghostfolioApiKey = settings[
PROPERTY_API_KEY_GHOSTFOLIO
] as string;
if (ghostfolioApiKey) {
this.adminService
.fetchGhostfolioDataProviderStatus(ghostfolioApiKey)
.pipe(
catchError(() => {
this.isGhostfolioApiKeyValid = false;
this.changeDetectorRef.markForCheck();
return of(null);
}),
filter((status) => {
return status !== null;
}),
takeUntil(this.unsubscribeSubject)
)
.subscribe((status) => {
this.ghostfolioApiStatus = status;
this.isGhostfolioApiKeyValid = true;
this.changeDetectorRef.markForCheck();
return of(null);
}),
filter((status) => {
return status !== null;
}),
takeUntil(this.unsubscribeSubject)
)
.subscribe((status) => {
this.ghostfolioApiStatus = status;
this.isGhostfolioApiKeyValid = true;
this.changeDetectorRef.markForCheck();
});
});
} else {
this.isGhostfolioApiKeyValid = false;
}
this.isLoading = false;