Removed use of platform service and created different service for SSR and CSR

This commit is contained in:
Giuseppe Digilio
2018-05-03 19:08:07 +02:00
parent 3b9a334258
commit c8a1fe0860
14 changed files with 234 additions and 106 deletions

View File

@@ -9,7 +9,8 @@ import 'rxjs/add/operator/takeWhile';
import { AuthenticateAction, ResetAuthenticationMessagesAction } from '../../core/auth/auth.actions';
import {
getAuthenticationError, getAuthenticationInfo,
getAuthenticationError,
getAuthenticationInfo,
isAuthenticated,
isAuthenticationLoading,
} from '../../core/auth/selectors';
@@ -18,7 +19,6 @@ import { CoreState } from '../../core/core.reducers';
import { isNotEmpty } from '../empty.util';
import { fadeOut } from '../animations/fade';
import { AuthService } from '../../core/auth/auth.service';
import { PlatformService } from '../services/platform.service';
/**
* /users/sign-in
@@ -56,6 +56,12 @@ export class LogInComponent implements OnDestroy, OnInit {
*/
public hasMessage = false;
/**
* Whether user is authenticated.
* @type {Observable<string>}
*/
public isAuthenticated: Observable<boolean>;
/**
* True if the authentication is loading.
* @type {boolean}
@@ -83,15 +89,18 @@ export class LogInComponent implements OnDestroy, OnInit {
constructor(
private authService: AuthService,
private formBuilder: FormBuilder,
private platform: PlatformService,
private store: Store<CoreState>
) { }
) {
}
/**
* Lifecycle hook that is called after data-bound properties of a directive are initialized.
* @method ngOnInit
*/
public ngOnInit() {
// set isAuthenticated
this.isAuthenticated = this.store.select(isAuthenticated);
// set formGroup
this.form = this.formBuilder.group({
email: ['', Validators.required],
@@ -144,7 +153,7 @@ export class LogInComponent implements OnDestroy, OnInit {
}
/**
* To to the registration page.
* To the registration page.
* @method register
*/
public register() {