diff --git a/apps/client/src/app/pages/api/api-page.component.ts b/apps/client/src/app/pages/api/api-page.component.ts index b949cfb0f..0f39c67d6 100644 --- a/apps/client/src/app/pages/api/api-page.component.ts +++ b/apps/client/src/app/pages/api/api-page.component.ts @@ -20,7 +20,7 @@ import { HttpHeaders, HttpParams } from '@angular/common/http'; -import { Component, DestroyRef, OnInit } from '@angular/core'; +import { Component, DestroyRef, inject, OnInit } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatCardModule } from '@angular/material/card'; import { format, startOfYear } from 'date-fns'; @@ -38,28 +38,29 @@ import { FetchFailure, FetchResult } from './interfaces/interfaces'; templateUrl: './api-page.html' }) export class GfApiPageComponent implements OnInit { - public aiServiceHealth$: Observable>; - public assetProfile$: Observable< + protected aiServiceHealth$: Observable>; + protected assetProfile$: Observable< FetchResult >; - public dividends$: Observable>; - public historicalData$: Observable< + protected dividends$: Observable>; + protected historicalData$: Observable< FetchResult >; - public isinLookupItems$: Observable>; - public lookupItems$: Observable>; - public quotes$: Observable>; - public status$: Observable>; + protected isinLookupItems$: Observable>; + protected lookupItems$: Observable>; + protected quotes$: Observable>; + protected status$: Observable< + FetchResult + >; private apiKey: string; - public constructor( - private destroyRef: DestroyRef, - private http: HttpClient - ) {} + private readonly destroyRef = inject(DestroyRef); + private readonly http = inject(HttpClient); public ngOnInit() { - this.apiKey = prompt($localize`Please enter your Ghostfolio API key:`); + this.apiKey = + prompt($localize`Please enter your Ghostfolio API key:`) ?? ''; this.aiServiceHealth$ = this.fetchAiServiceHealth(); this.assetProfile$ = this.fetchAssetProfile({ symbol: 'AAPL' }); @@ -71,7 +72,7 @@ export class GfApiPageComponent implements OnInit { this.status$ = this.fetchStatus(); } - public isFetchFailure(value: unknown): value is FetchFailure { + protected isFetchFailure(value: unknown): value is FetchFailure { return isObject(value) && value !== null && 'fetchError' in value; } diff --git a/apps/client/src/app/pages/public/public-page.component.ts b/apps/client/src/app/pages/public/public-page.component.ts index 43d961c1d..91410d5f7 100644 --- a/apps/client/src/app/pages/public/public-page.component.ts +++ b/apps/client/src/app/pages/public/public-page.component.ts @@ -249,7 +249,7 @@ export class GfPublicPageComponent implements OnInit { } this.symbols[prettifySymbol(symbol)] = { - name: position.assetProfile.name, + name: position.assetProfile.name ?? prettifySymbol(symbol), symbol: prettifySymbol(symbol), value: isNumber(position.valueInBaseCurrency) ? position.valueInBaseCurrency