From 3f9d5f45f9bf94f907716dc6566980763fc90150 Mon Sep 17 00:00:00 2001
From: Yannick Baron
Date: Thu, 27 Oct 2016 13:25:57 +0200
Subject: [PATCH 1/8] auth.component: fixed minor tslint complaint
---
src/app/auth/auth.component.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts
index f5d63df4..8820f031 100644
--- a/src/app/auth/auth.component.ts
+++ b/src/app/auth/auth.component.ts
@@ -8,22 +8,22 @@ import { Errors, UserService } from '../shared';
templateUrl: './auth.component.html'
})
export class AuthComponent implements OnInit {
- constructor(
- private route: ActivatedRoute,
- private router: Router,
- private userService: UserService
- ) {}
-
authType: String = '';
title: String = '';
errors: Errors = new Errors();
credentials: Object = {};
isSubmitting: boolean = false;
+ constructor(
+ private route: ActivatedRoute,
+ private router: Router,
+ private userService: UserService
+ ) {}
+
ngOnInit() {
this.route.url.subscribe(data => {
// Get the last piece of the URL (it's either 'login' or 'register')
- this.authType = data[data.length-1].path;
+ this.authType = data[data.length - 1].path;
// Set a title for the page accordingly
this.title = (this.authType === 'login') ? 'Sign in' : 'Sign up';
});
From 068b7e4bbab7d7903811dfe7d6b0e46fb826d558 Mon Sep 17 00:00:00 2001
From: Yannick Baron
Date: Thu, 27 Oct 2016 13:49:35 +0200
Subject: [PATCH 2/8] user.service: fixed minor tslint complaint
---
src/app/shared/services/user.service.ts | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/app/shared/services/user.service.ts b/src/app/shared/services/user.service.ts
index 2f4206c1..271efbdb 100644
--- a/src/app/shared/services/user.service.ts
+++ b/src/app/shared/services/user.service.ts
@@ -13,18 +13,18 @@ import { User } from '../models';
@Injectable()
export class UserService {
- constructor (
- private apiService: ApiService,
- private http: Http,
- private jwtService: JwtService
- ) {}
-
private currentUserSubject = new BehaviorSubject(new User());
public currentUser = this.currentUserSubject.asObservable().distinctUntilChanged();
private isAuthenticatedSubject = new ReplaySubject(1);
public isAuthenticated = this.isAuthenticatedSubject.asObservable();
+ constructor (
+ private apiService: ApiService,
+ private http: Http,
+ private jwtService: JwtService
+ ) {}
+
// Verify JWT in localstorage with server & load user's info.
// This runs once on application startup.
populate() {
From 7eb3e2ad6aaee7036d0b9daa1fd9d09d7b419ed4 Mon Sep 17 00:00:00 2001
From: Yannick Baron
Date: Thu, 27 Oct 2016 13:50:04 +0200
Subject: [PATCH 3/8] added ReactiveFormsModule to SharedModule
---
src/app/shared/shared.module.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index b6e95d4c..463897a0 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
-import { FormsModule } from '@angular/forms';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
@@ -13,6 +13,7 @@ import { ShowAuthedDirective } from './show-authed.directive';
imports: [
CommonModule,
FormsModule,
+ ReactiveFormsModule,
HttpModule,
RouterModule
],
@@ -33,6 +34,7 @@ import { ShowAuthedDirective } from './show-authed.directive';
FavoriteButtonComponent,
FollowButtonComponent,
FormsModule,
+ ReactiveFormsModule,
HttpModule,
ListErrorsComponent,
RouterModule,
From 7be69e3a454997fef04b36b022d02d5de76e19a2 Mon Sep 17 00:00:00 2001
From: Yannick Baron
Date: Thu, 27 Oct 2016 13:56:28 +0200
Subject: [PATCH 4/8] auth.component: making use of the (reactive) forms api
---
src/app/auth/auth.component.html | 11 ++++-------
src/app/auth/auth.component.ts | 21 +++++++++++++++++----
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/app/auth/auth.component.html b/src/app/auth/auth.component.html
index 63984355..beba6eed 100644
--- a/src/app/auth/auth.component.html
+++ b/src/app/auth/auth.component.html
@@ -9,12 +9,11 @@ {{ title }}
Need an account?
-