Skip to content

Commit b7b1c39

Browse files
committed
Fix linting
1 parent 095ca84 commit b7b1c39

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

frontend/src/_helpers/interceptors/error.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ErrorInterceptor implements HttpInterceptor {
1515
console.error(err);
1616

1717
const errorMessage = err.error.message;
18-
return throwError(() => new Error(errorMessage, {cause: err}));
18+
return throwError(() => new Error(errorMessage, { cause: err }));
1919
}),
2020
);
2121
}

frontend/src/_services/authentication.service.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Modified from https://jasonwatmore.com/post/2022/11/15/angular-14-jwt-authentication-example-tutorial#login-component-ts
22
import { Injectable } from '@angular/core';
33
import { Router } from '@angular/router';
4-
import { HttpClient, HttpResponse } from '@angular/common/http';
4+
import { HttpClient } from '@angular/common/http';
55
import { BehaviorSubject, Observable } from 'rxjs';
6-
import { map, switchMap, tap } from 'rxjs/operators';
6+
import { map, switchMap } from 'rxjs/operators';
77
import { environment } from '../_environments/environment';
88
import { User } from '../_models/user.model';
99
import { UServRes } from '../_models/user.service.response.interface';
@@ -28,14 +28,12 @@ export class AuthenticationService {
2828
login(username: string, password: string) {
2929
console.log('login', `${environment.UserServiceApiUrl}/auth/login`);
3030
return this.http
31-
.post<UServRes>(`${environment.UserServiceApiUrl}/auth/login`,
31+
.post<UServRes>(
32+
`${environment.UserServiceApiUrl}/auth/login`,
3233
{ username: username, password: password },
33-
{ observe: 'response' })
34+
{ observe: 'response' },
35+
)
3436
.pipe(
35-
tap(response => {
36-
console.log(response.status);
37-
console.dir(response.body);
38-
}),
3937
map(response => {
4038
// store user details and jwt token in local storage to keep user logged in between page refreshes
4139
let user: User = {};
@@ -60,9 +58,11 @@ export class AuthenticationService {
6058

6159
createAccount(username: string, email: string, password: string) {
6260
return this.http
63-
.post<UServRes>(`${environment.UserServiceApiUrl}/users`,
64-
{ username: username, email: email, password: password},
65-
{ observe: 'response' })
61+
.post<UServRes>(
62+
`${environment.UserServiceApiUrl}/users`,
63+
{ username: username, email: email, password: password },
64+
{ observe: 'response' },
65+
)
6666
.pipe(switchMap(() => this.login(username, password))); // auto login after registration
6767
}
6868

frontend/src/app/account/login.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,13 @@ export class LoginComponent {
5757
let errorMessage = 'An unknown error occurred';
5858
if (status === 400) {
5959
errorMessage = 'Missing Fields';
60-
}
61-
else if (status === 401) {
60+
} else if (status === 401) {
6261
errorMessage = 'Invalid username or password';
63-
}
64-
else if (status === 500) {
62+
} else if (status === 500) {
6563
errorMessage = 'Database Server Error';
6664
}
6765
this.messageService.add({ severity: 'error', summary: 'Log In Error', detail: errorMessage });
68-
}
66+
},
6967
});
7068
} else {
7169
console.log('Invalid form');

frontend/src/app/account/register.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ export class RegisterComponent {
110110
let errorMessage = 'An unknown error occurred';
111111
if (status === 400) {
112112
errorMessage = 'Missing Fields';
113-
}
114-
else if (status === 409) {
113+
} else if (status === 409) {
115114
errorMessage = 'Username or Password already exists';
116-
}
117-
else if (status === 500) {
115+
} else if (status === 500) {
118116
errorMessage = 'Database Server Error';
119117
}
120118
this.messageService.add({ severity: 'error', summary: 'Log In Error', detail: errorMessage });

0 commit comments

Comments
 (0)