Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove debug prints #219

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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