From 5521f5c56d036f6406f258379578a838dd613f2f Mon Sep 17 00:00:00 2001 From: yhedholm Date: Sun, 11 Dec 2022 22:35:46 -0800 Subject: [PATCH 1/2] remove debug prints --- .../src/app/services/response-status-handler.service.ts | 4 ---- 1 file changed, 4 deletions(-) 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 9ef5465..a1441cd 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 From e4495c6e8801cb01e4661ffe9ec43a2f5ddd0a02 Mon Sep 17 00:00:00 2001 From: yhedholm Date: Sun, 11 Dec 2022 23:11:58 -0800 Subject: [PATCH 2/2] clean up header generation --- .../app/services/header-utility.service.ts | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/frontend/rolecall/src/app/services/header-utility.service.ts b/frontend/rolecall/src/app/services/header-utility.service.ts index 4adcd04..2cc9d8b 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, }); } });