diff options
| author | Kamen Mladenov <kamen.d.mladenov@protonmail.com> | 2021-04-09 19:55:59 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-09 19:55:59 +0300 |
| commit | f849e37ccdd6fd48f83119a3b3b65cdd8b765dc3 (patch) | |
| tree | 83b88a773bb7dc053bb3aced35bce302264ec925 /src/app/components/error-bar | |
| parent | bcd88af53b1a920d728ec98b45daa9ac2e2c0917 (diff) | |
| parent | c13889759d70687de6833c505221c203f65fedb8 (diff) | |
| download | DevHive-Angular-0.2.tar DevHive-Angular-0.2.tar.gz DevHive-Angular-0.2.zip | |
Second Stage: Complete
Diffstat (limited to 'src/app/components/error-bar')
| -rw-r--r-- | src/app/components/error-bar/error-bar.component.css | 2 | ||||
| -rw-r--r-- | src/app/components/error-bar/error-bar.component.ts | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/app/components/error-bar/error-bar.component.css b/src/app/components/error-bar/error-bar.component.css index 8f8edd9..880f205 100644 --- a/src/app/components/error-bar/error-bar.component.css +++ b/src/app/components/error-bar/error-bar.component.css @@ -5,6 +5,8 @@ color: white; padding: .2em; text-align: center; + word-wrap: break-word; + white-space: pre-wrap; } #error-bar:empty { 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 { |
