From 5117c15b4856d6296b28e67e259c2ca1576b8794 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 28 Mar 2021 17:29:48 +0300 Subject: Improved how error-bar handles error messages --- src/app/components/error-bar/error-bar.component.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/app/components/error-bar/error-bar.component.ts') diff --git a/src/app/components/error-bar/error-bar.component.ts b/src/app/components/error-bar/error-bar.component.ts index 111bac8..277552b 100644 --- a/src/app/components/error-bar/error-bar.component.ts +++ b/src/app/components/error-bar/error-bar.component.ts @@ -1,6 +1,5 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; -import { IApiError } from 'src/interfaces/api-error'; @Component({ selector: 'app-error-bar', @@ -18,14 +17,15 @@ export class ErrorBarComponent implements OnInit { } showError(error: HttpErrorResponse): void { - const test: IApiError = { - type: '', - title: 'Error!', - status: 0, - traceId: '' - }; - Object.assign(test, error.error); - this.errorMsg = test.title; + this.errorMsg = ''; + + const errors: string[][] = Object.values(Object.values(error.error)[0] as any); + + for (const errorArr of errors) { + for (const errorMsg of errorArr) { + this.errorMsg += errorMsg + '\n'; + } + } } hideError(): void { -- cgit v1.2.3