11import  {  Component ,  EventEmitter ,  OnInit ,  Output  }  from  '@angular/core' ; 
22import  {  FormControl ,  FormGroup ,  Validators  }  from  '@angular/forms' ; 
3+ import  {  AppConfig  }  from  '../../../../app.config' ; 
34
45@Component ( { 
56  selector : 'app-login-form' , 
@@ -9,19 +10,22 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
910export  class  LoginFormComponent  implements  OnInit  { 
1011  @Output ( )  sendLoginForm  =  new  EventEmitter < void > ( ) ; 
1112  public  form : FormGroup ; 
12-   public  flatlogicEmail  =  '[email protected] ' ;  13-   public  flatlogicPassword  =  'admin' ; 
13+   config : any ; 
14+ 
15+   constructor ( appConfig : AppConfig )  { 
16+     this . config  =  appConfig . getConfig ( ) ; 
17+   } 
1418
1519  public  ngOnInit ( ) : void { 
1620    this . form  =  new  FormGroup ( { 
17-       email : new  FormControl ( this . flatlogicEmail ,  [ Validators . required ,  Validators . email ] ) , 
18-       password : new  FormControl ( this . flatlogicPassword ,  [ Validators . required ] ) 
21+       email : new  FormControl ( this . config . auth . email ,  [ Validators . required ,  Validators . email ] ) , 
22+       password : new  FormControl ( this . config . auth . password ,  [ Validators . required ] ) 
1923    } ) ; 
2024  } 
2125
2226  public  login ( ) : void { 
2327    if  ( this . form . valid )  { 
24-       this . sendLoginForm . emit ( ) ; 
28+       this . sendLoginForm . emit ( this . form . value ) ; 
2529    } 
2630  } 
2731} 
0 commit comments