From eecd2cebab41aa3252c251b7f923dbc2e9f45573 Mon Sep 17 00:00:00 2001 From: WolfgangEdholm <66700542+WolfgangEdholm@users.noreply.github.com> Date: Sun, 11 Dec 2022 23:45:32 -0800 Subject: [PATCH] remove debug prints (#219) * remove debug prints * clean up header generation Co-authored-by: yhedholm --- .../app/services/header-utility.service.ts | 29 +++++-------------- .../response-status-handler.service.ts | 4 --- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/frontend/rolecall/src/app/services/header-utility.service.ts b/frontend/rolecall/src/app/services/header-utility.service.ts index 4adcd045..2cc9d8b8 100644 --- a/frontend/rolecall/src/app/services/header-utility.service.ts +++ b/frontend/rolecall/src/app/services/header-utility.service.ts @@ -30,40 +30,27 @@ export class HeaderUtilityService { headerType: HeaderType = HeaderType.json, ): Promise => { this.updateSentToken(); + const email = environment.useDevEmail ? environment.devEmail : + this.loginApi.email; return this.loginApi.loginPromise.then(() => { if (this.sentToken) { if (headerType === HeaderType.jpg) { - return new HttpHeaders({ - 'Content-Type': 'image/jpg', - EMAIL: environment.useDevEmail ? environment.devEmail : - this.loginApi.email, - }); + return new HttpHeaders({ 'Content-Type': 'image/jpg', email }); } if (headerType === HeaderType.png) { - return new HttpHeaders({ - 'Content-Type': 'image/png', - EMAIL: environment.useDevEmail ? environment.devEmail : - this.loginApi.email, - }); + return new HttpHeaders({ 'Content-Type': 'image/png', email }); } if (headerType === HeaderType.formData) { - return new HttpHeaders({ - EMAIL: environment.useDevEmail ? environment.devEmail : - this.loginApi.email, - }); + return new HttpHeaders({ email }); } return new HttpHeaders({ - 'Content-Type': 'application/json; charset=utf-8', - EMAIL: environment.useDevEmail ? environment.devEmail : - this.loginApi.email, - }); + 'Content-Type': 'application/json; charset=utf-8', email }); } else { this.sentToken = true; return new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8', - EMAIL: environment.useDevEmail ? environment.devEmail : - this.loginApi.email, - AUTHORIZATION: 'Bearer ' + this.loginApi.credential, + email, + authorization: 'Bearer ' + this.loginApi.credential, }); } }); diff --git a/frontend/rolecall/src/app/services/response-status-handler.service.ts b/frontend/rolecall/src/app/services/response-status-handler.service.ts index 9ef5465d..a1441cd2 100644 --- a/frontend/rolecall/src/app/services/response-status-handler.service.ts +++ b/frontend/rolecall/src/app/services/response-status-handler.service.ts @@ -36,7 +36,6 @@ export class ResponseStatusHandlerService { showError = async (errorEvent: ErrorEvent): Promise => { if (this.pendingErrors.has(errorEvent.url)) { // TODO: What should we return here? -console.log('EARLY RETURN', errorEvent.url); return Promise.resolve(''); } let resFunc; @@ -44,7 +43,6 @@ console.log('EARLY RETURN', errorEvent.url); resFunc = res; }); this.pendingErrors.set(errorEvent.url, [prom, resFunc]); -console.log('ERROR EVENT', errorEvent); const dialogRef = this.dialog.open(ErrorDialog, { width: '50%', data: { errorEvent } }); return lastValueFrom(dialogRef.afterClosed()).then(() => prom); @@ -53,7 +51,6 @@ console.log('ERROR EVENT', errorEvent); resolveError = (errEv: ErrorEvent, userResp: string): void => { const resolveThis = this.pendingErrors.get(errEv.url); if (resolveThis) { -console.log('RESOLVING', this.pendingErrors.size, this.pendingErrors); resolveThis[1](userResp); this.pendingErrors.delete(errEv.url); } @@ -80,7 +77,6 @@ console.log('RESOLVING', this.pendingErrors.size, this.pendingErrors); // } if (response.status < 200 || response.status > 299) { const rsp = response as any; -console.log('ERROR RESPONSE', rsp); const errorEvent: ErrorEvent = { url: response.url, errorMessage: rsp.error?.error?.length > 0