11import { Component , OnInit } from '@angular/core' ;
22import { FormBuilder , FormGroup , Validators } from '@angular/forms' ;
33import { ActivatedRoute , Router } from '@angular/router' ;
4- import { LoginService } from '../ service/login .service' ;
4+ import { AuthenticationService } from '@app/authentication/ service/authentication .service' ;
55
66@Component ( {
7- selector : 'login-form' ,
7+ selector : 'dahs- login-form' ,
88 templateUrl : './login-form.component.html' ,
99 styleUrls : [ './login-form.component.sass' ]
1010} )
@@ -20,10 +20,10 @@ export class LoginFormComponent implements OnInit {
2020 private formBuilder : FormBuilder ,
2121 private route : ActivatedRoute ,
2222 private router : Router ,
23- private loginService : LoginService
23+ private authenticationService : AuthenticationService
2424 ) {
2525 // redirect to home if already logged in
26- if ( this . loginService . user . logged ) {
26+ if ( this . authenticationService . getUser ( ) . logged ) {
2727 this . router . navigate ( [ '/' ] ) ;
2828 }
2929
@@ -50,7 +50,7 @@ export class LoginFormComponent implements OnInit {
5050 }
5151
5252 this . loading = true ;
53- this . loginService . login ( this . f [ 'username' ] . value , this . f [ 'password' ] . value )
53+ this . authenticationService . login ( this . f [ 'username' ] . value , this . f [ 'password' ] . value )
5454 . subscribe ( {
5555 next : user => {
5656 this . loading = false ;
0 commit comments