aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-01-23 15:48:43 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-01-23 15:48:43 +0200
commita8ae9db5098ffead085986619f220d237eac12f0 (patch)
tree6f41c50ab297aece018b887ff2eb04000b3407d4
parentdf06bc309d44db352441f42de7d34794a6ee54ba (diff)
downloadDevHive-a8ae9db5098ffead085986619f220d237eac12f0.tar
DevHive-a8ae9db5098ffead085986619f220d237eac12f0.tar.gz
DevHive-a8ae9db5098ffead085986619f220d237eac12f0.zip
Error bar now shows the actual error message from the api
-rw-r--r--src/DevHive.Angular/src/app/components/error-bar/error-bar.component.ts5
-rw-r--r--src/DevHive.Angular/src/app/components/register/register.component.ts2
-rw-r--r--src/DevHive.Angular/src/interfaces/api-error.ts6
3 files changed, 11 insertions, 2 deletions
diff --git a/src/DevHive.Angular/src/app/components/error-bar/error-bar.component.ts b/src/DevHive.Angular/src/app/components/error-bar/error-bar.component.ts
index 40a13e7..c24448e 100644
--- a/src/DevHive.Angular/src/app/components/error-bar/error-bar.component.ts
+++ b/src/DevHive.Angular/src/app/components/error-bar/error-bar.component.ts
@@ -1,5 +1,6 @@
import {HttpErrorResponse} from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
+import {IApiError} from 'src/interfaces/api-error';
@Component({
selector: 'app-error-bar',
@@ -16,7 +17,9 @@ export class ErrorBarComponent implements OnInit {
}
showError(error: HttpErrorResponse): void {
- this.errorMsg = error.statusText;
+ const test: IApiError = { type: '', title: 'Error!', status: 0, traceId: '' };
+ Object.assign(test, error.error);
+ this.errorMsg = test.title;
}
hideError(): void {
diff --git a/src/DevHive.Angular/src/app/components/register/register.component.ts b/src/DevHive.Angular/src/app/components/register/register.component.ts
index aeaa4d8..832d176 100644
--- a/src/DevHive.Angular/src/app/components/register/register.component.ts
+++ b/src/DevHive.Angular/src/app/components/register/register.component.ts
@@ -45,7 +45,7 @@ export class RegisterComponent implements OnInit {
]),
});
- this.registerUserFormGroup.valueChanges.subscribe(console.log);
+ // this.registerUserFormGroup.valueChanges.subscribe(console.log);
}
onSubmit(): void {
diff --git a/src/DevHive.Angular/src/interfaces/api-error.ts b/src/DevHive.Angular/src/interfaces/api-error.ts
new file mode 100644
index 0000000..4dd68f3
--- /dev/null
+++ b/src/DevHive.Angular/src/interfaces/api-error.ts
@@ -0,0 +1,6 @@
+export interface IApiError {
+ type: string;
+ title: string;
+ status: number;
+ traceId: string;
+}