From 2eddb4dd9c0876bafe5aa8dad76cbc5326cbf0a0 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 20 Mar 2018 16:53:14 +0000 Subject: [PATCH] fixed httpclient error logging --- src/app/auth/register.component.ts | 18 +++--------------- src/app/dashboard/account-edit.component.ts | 9 +-------- src/app/dashboard/add-data.component.ts | 3 +-- src/app/dashboard/feedback.component.ts | 10 +--------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/app/auth/register.component.ts b/src/app/auth/register.component.ts index 419eeef..43c6c69 100644 --- a/src/app/auth/register.component.ts +++ b/src/app/auth/register.component.ts @@ -78,24 +78,18 @@ export class RegisterComponent { .register(data) .subscribe( result => { - console.log('registered!'); this.registerStatus = 'success'; - console.log(this.registerStatus); this.router.navigate(['/dashboard']); }, error => { console.log('Register Error'); console.log(error); try { - console.log(error.error); - const jsonError = error.json(); - console.log('boop'); - this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + this.registerStatusError = '"' + error.error.error + '" Error, ' + error.error.message; } catch (e) { this.registerStatusError = 'There was a server error, please try again later.'; } this.registerStatus = 'send_failed'; - console.log(this.registerStatus); } ); } @@ -127,19 +121,13 @@ export class RegisterComponent { .register(data) .subscribe( result => { - console.log('registered!'); this.registerStatus = 'success'; - console.log(this.registerStatus); this.router.navigate(['/dashboard']); }, - error => { - console.log('Register Error'); + error => console.log(error); try { - console.log(error.error); - const jsonError = error.json(); - console.log('boop'); - this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + this.registerStatusError = '"' + error.error.error + '" Error, ' + error.error.message; } catch (e) { this.registerStatusError = 'There was a server error, please try again later.'; } diff --git a/src/app/dashboard/account-edit.component.ts b/src/app/dashboard/account-edit.component.ts index 7590154..ea839fd 100644 --- a/src/app/dashboard/account-edit.component.ts +++ b/src/app/dashboard/account-edit.component.ts @@ -105,23 +105,17 @@ export class AccountEditComponent implements OnInit { .accountEditUpdate(submitData) .subscribe( result => { - console.log('data submitted!'); this.submitStatus = 'success'; - console.log(this.submitStatus); }, error => { console.log('Edit Error'); console.log(error); try { - console.log(error.error); - const jsonError = error.json(); - console.log('boop'); - this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + this.submitStatusError = '"' + error.error.error + '" Error, ' + error.error.message; } catch (e) { this.submitStatusError = 'There was a server error, please try again later.'; } this.submitStatus = 'send_failed'; - console.log(this.submitStatus); } ); } @@ -131,7 +125,6 @@ export class AccountEditComponent implements OnInit { if (!this.settingForm.valid && !this.settingCustomerForm.valid) { console.log('Not Valid!'); this.submitStatus = 'validation_failed'; - console.log(this.submitStatus); return; } diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index ee65cee..34b0ca3 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -247,8 +247,7 @@ export class AddDataComponent implements OnInit { console.log(error); try { console.log(error.error); - const jsonError = error.json(); - this.transactionFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + this.transactionFormStatusError = '"' + error.error.error + '" Error, ' + error.error.message; } catch (e) { this.transactionFormStatusError = 'There was a server error, please try again later.'; } diff --git a/src/app/dashboard/feedback.component.ts b/src/app/dashboard/feedback.component.ts index 5228a3c..0603fbc 100644 --- a/src/app/dashboard/feedback.component.ts +++ b/src/app/dashboard/feedback.component.ts @@ -55,9 +55,7 @@ export class FeedbackComponent implements OnInit { result => { if ( result.success === true ) { console.log('Successful Upload'); - console.log(result); this.feedbackFormStatus = 'success'; - console.log(this.feedbackFormStatus); this.feedbackForm.patchValue({ feedbacktext: '', }); @@ -65,22 +63,16 @@ export class FeedbackComponent implements OnInit { console.log('Upload Error'); this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message); this.feedbackFormStatus = 'send_failed'; - console.log(this.feedbackFormStatus); } }, error => { console.log('Upload Error'); - console.log(error); try { - console.log(error.error); - const jsonError = error.json(); - console.log('boop'); - this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + this.feedbackFormStatusError = '"' + error.error.error + '" Error, ' + error.error.message; } catch (e) { this.feedbackFormStatusError = 'There was a server error, please try again later.'; } this.feedbackFormStatus = 'send_failed'; - console.log(this.feedbackFormStatus); } ); }