11import { Component , OnInit } from '@angular/core' ;
22import { FormBuilder , FormGroup , Validators } from '@angular/forms' ;
33import { ActivatedRoute , Router } from '@angular/router' ;
4- import { AuthenticationService } from '@app/authentication/service/authentication.service' ;
5- import { first } from 'rxjs/operators' ;
64import { LoginService } from '../service/login.service' ;
75
86@Component ( {
9- selector : 'dahs- login-form' ,
7+ selector : 'login-form' ,
108 templateUrl : './login-form.component.html' ,
119 styleUrls : [ './login-form.component.sass' ]
1210} )
@@ -22,8 +20,7 @@ export class LoginFormComponent implements OnInit {
2220 private formBuilder : FormBuilder ,
2321 private route : ActivatedRoute ,
2422 private router : Router ,
25- private loginService : LoginService ,
26- private authenticationService : AuthenticationService
23+ private loginService : LoginService
2724 ) {
2825 // redirect to home if already logged in
2926 if ( this . loginService . user . logged ) {
@@ -58,12 +55,7 @@ export class LoginFormComponent implements OnInit {
5855 next : user => {
5956 this . loading = false ;
6057 if ( user . logged ) {
61- if ( user . authdata ) {
62- this . authenticationService . saveToken ( user . authdata ) ;
63- }
6458 this . router . navigate ( [ this . returnUrl ] ) ;
65- } else {
66- this . authenticationService . saveToken ( '' ) ;
6759 }
6860 } ,
6961 error : error => {
0 commit comments