Browse Source

feat(client): migrate errors to input signal

pull/7265/head
KenTandrian 1 week ago
parent
commit
8d70e1c0bc
  1. 2
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html
  2. 9
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

2
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html

@ -1,7 +1,7 @@
<div class="container p-0">
<div class="no-gutters row">
<div class="status-container text-muted text-right">
@if (errors?.length > 0 && !isLoading) {
@if (errors()?.length > 0 && !isLoading) {
<ion-icon
i18n-title
name="time-outline"

9
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

@ -15,6 +15,7 @@ import {
Component,
ElementRef,
inject,
input,
Input,
OnChanges,
viewChild
@ -34,7 +35,6 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
templateUrl: './portfolio-performance.component.html'
})
export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() errors: ResponseError['errors'];
@Input() isLoading: boolean;
@Input() locale = getLocale();
@Input() performance: PortfolioPerformance;
@ -42,6 +42,8 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() showDetails: boolean;
@Input() unit: string;
public readonly errors = input<ResponseError['errors']>();
private readonly value =
viewChild.required<ElementRef<HTMLSpanElement>>('value');
@ -84,13 +86,14 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
}
protected onShowErrors() {
if (!this.errors?.length) {
const errors = this.errors();
if (!errors?.length) {
return;
}
const errorMessageParts: string[] = [];
for (const error of this.errors) {
for (const error of errors) {
errorMessageParts.push(`${error.symbol} (${error.dataSource})`);
}

Loading…
Cancel
Save