Skip to content

Commit

Permalink
remove debug prints (#219)
Browse files Browse the repository at this point in the history
* remove debug prints

* clean up header generation

Co-authored-by: yhedholm <yedholm@gmail.com>
  • Loading branch information
WolfgangEdholm and yhedholm committed Dec 12, 2022
1 parent c201317 commit eecd2ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
29 changes: 8 additions & 21 deletions frontend/rolecall/src/app/services/header-utility.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,27 @@ export class HeaderUtilityService {
headerType: HeaderType = HeaderType.json,
): Promise<HttpHeaders> => {
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,
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ export class ResponseStatusHandlerService {
showError = async (errorEvent: ErrorEvent): Promise<string> => {
if (this.pendingErrors.has(errorEvent.url)) {
// TODO: What should we return here?
console.log('EARLY RETURN', errorEvent.url);
return Promise.resolve('');
}
let resFunc;
const prom: Promise<string> = new Promise(res => {
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);
Expand All @@ -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);
}
Expand All @@ -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
Expand Down

0 comments on commit eecd2ce

Please sign in to comment.