diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-12 19:04:53 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-12 19:04:53 +0200 |
| commit | bcd88af53b1a920d728ec98b45daa9ac2e2c0917 (patch) | |
| tree | fd27eef086822b0f02f74364cac0b940956d2458 /src/app/components/error-bar/error-bar.component.ts | |
| parent | 1d1f05e3f74d70a558b4847a9107afa7952131cf (diff) | |
| download | DevHive-Angular-bcd88af53b1a920d728ec98b45daa9ac2e2c0917.tar DevHive-Angular-bcd88af53b1a920d728ec98b45daa9ac2e2c0917.tar.gz DevHive-Angular-bcd88af53b1a920d728ec98b45daa9ac2e2c0917.zip | |
Moved from DevHive
Diffstat (limited to 'src/app/components/error-bar/error-bar.component.ts')
| -rw-r--r-- | src/app/components/error-bar/error-bar.component.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/app/components/error-bar/error-bar.component.ts b/src/app/components/error-bar/error-bar.component.ts new file mode 100644 index 0000000..111bac8 --- /dev/null +++ b/src/app/components/error-bar/error-bar.component.ts @@ -0,0 +1,34 @@ +import { HttpErrorResponse } from '@angular/common/http'; +import { Component, OnInit } from '@angular/core'; +import { IApiError } from 'src/interfaces/api-error'; + +@Component({ + selector: 'app-error-bar', + templateUrl: './error-bar.component.html', + styleUrls: ['./error-bar.component.css'] +}) +export class ErrorBarComponent implements OnInit { + public errorMsg = ''; + + constructor() + { } + + ngOnInit(): void { + this.hideError(); + } + + showError(error: HttpErrorResponse): void { + const test: IApiError = { + type: '', + title: 'Error!', + status: 0, + traceId: '' + }; + Object.assign(test, error.error); + this.errorMsg = test.title; + } + + hideError(): void { + this.errorMsg = ''; + } +} |
