CP TsLint small changes

This commit is contained in:
ThomasFransolet 2019-07-14 02:45:44 +02:00
parent fc1c96552d
commit b88b3da9e0
5 changed files with 28 additions and 31 deletions

View File

@ -10,7 +10,7 @@ export class JwtInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// add authorization header with jwt token if available // add authorization header with jwt token if available
let currentUser = this._authService.currentUserValue; const currentUser = this._authService.currentUserValue;
if (currentUser && currentUser.token) { if (currentUser && currentUser.token) {
request = request.clone({ request = request.clone({
setHeaders: { setHeaders: {

View File

@ -38,7 +38,7 @@ export class AuthenticationService {
// store user details and jwt token in local storage to keep user logged in between page refreshes // store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user)); localStorage.setItem('currentUser', JSON.stringify(user));
this.currentUserSubject.next(user); this.currentUserSubject.next(user);
console.log('This is USER = ',user) console.log('This is USER = ', user );
return user; return user;
})); }));
} }

View File

@ -24,7 +24,6 @@ const routes: Routes =
] ]
}, },
{ path: '**', component: NotFoundComponent} { path: '**', component: NotFoundComponent}
]; ];
@NgModule({ @NgModule({

View File

@ -17,10 +17,10 @@ export class AppComponent implements OnInit{
items: MenuItem[]; items: MenuItem[];
public Connected : boolean = false; public Connected = false;
public DisplayLoginModal: boolean = false; public DisplayLoginModal = false;
public DisplaySignInModal: boolean = false; public DisplaySignInModal = false;
public DisplayPersonalField: boolean = false; public DisplayPersonalField = false;
// Login // Login
public Username: string = null; public Username: string = null;
@ -43,7 +43,7 @@ export class AppComponent implements OnInit{
// To Include in a fonction of a dropdown language chose // To Include in a fonction of a dropdown language chose
this._translateService.setDefaultLang('fr'); this._translateService.setDefaultLang('fr');
let currentUser = this._authService.currentUserValue; const currentUser = this._authService.currentUserValue;
console.log(currentUser); console.log(currentUser);
if (currentUser && currentUser.token) { if (currentUser && currentUser.token) {
@ -58,8 +58,7 @@ export class AppComponent implements OnInit{
} }
public LogIn() public LogIn() {
{
/*this._appService.GetToken(this.Username, this.Password) /*this._appService.GetToken(this.Username, this.Password)
.subscribe(res => { .subscribe(res => {
console.log(res.Token); console.log(res.Token);
@ -101,8 +100,7 @@ export class AppComponent implements OnInit{
this._authService.IsLoggedIn = false; this._authService.IsLoggedIn = false;
this._router.navigate(['/home']); this._router.navigate(['/home']);
} }
public SignUp() public SignUp() {
{
this.DisplaySignInModal = true; this.DisplaySignInModal = true;
} }
} }