@@ -40,10 +40,10 @@ export class UserComponent {
4040 onAccountDeleted : EventEmitter < void > = new EventEmitter ( ) ;
4141
4242 updateFormGroup : FormGroup ;
43- updateNameFormControl : AbstractControl ;
44- updateEmailFormControl : AbstractControl ;
45- updatePhoneNumberFormControl : AbstractControl ;
46- updatePasswordFormControl : AbstractControl ;
43+ updateNameFormControl : FormControl ;
44+ updateEmailFormControl : FormControl ;
45+ updatePhoneNumberFormControl : FormControl ;
46+ updatePasswordFormControl : FormControl ;
4747
4848 constructor ( @Inject ( NgxAuthFirebaseUIConfigToken )
4949 public config : NgxAuthFirebaseUIConfig ,
@@ -57,7 +57,7 @@ export class UserComponent {
5757 const currentUser : User = this . auth . auth . currentUser ;
5858 this . updateFormGroup = new FormGroup ( {
5959 name : this . updateNameFormControl = new FormControl (
60- { value : currentUser . displayName , disabled : true } ,
60+ { value : currentUser . displayName , disabled : this . editMode } ,
6161 [
6262 Validators . required ,
6363 Validators . minLength ( 2 ) ,
@@ -66,13 +66,14 @@ export class UserComponent {
6666 ) ,
6767
6868 email : this . updateEmailFormControl = new FormControl (
69- { value : currentUser . email , disabled : true } ,
69+ { value : currentUser . email , disabled : this . editMode } ,
7070 [
7171 Validators . required ,
7272 Validators . pattern ( EMAIL_REGEX )
7373 ] ) ,
7474
75- phoneNumber : this . updatePhoneNumberFormControl = new FormControl ( '' ,
75+ phoneNumber : this . updatePhoneNumberFormControl = new FormControl (
76+ { value : currentUser . phoneNumber , disabled : this . editMode } ,
7677 [ Validators . pattern ( PHONE_NUMBER_REGEX ) ] )
7778 } ) ;
7879
@@ -91,7 +92,6 @@ export class UserComponent {
9192 this . updateFormGroup = null ;
9293 }
9394
94- // todo: 31.3.18
9595 async save ( ) {
9696 if ( this . updateFormGroup . dirty ) {
9797 const user = this . auth . auth . currentUser ;
@@ -125,8 +125,6 @@ export class UserComponent {
125125 } catch ( error ) {
126126 error . message ? this . snackBar . open ( error . message , 'Ok' ) : this . snackBar . open ( error , 'Ok' ) ;
127127 console . error ( error ) ;
128- console . error ( error . code ) ;
129- console . error ( error . message ) ;
130128 }
131129
132130
@@ -162,10 +160,9 @@ export class UserComponent {
162160 const user = this . auth . auth . currentUser ;
163161
164162 await this . authProcess . deleteAccount ( ) ;
165- // TODO(13.02.19) @anthoynahas: error while delete ngx-auth-firebaseui-user data by ngx-auth-firebaseui-user id
166- // if (this.config.enableFirestoreSync) {
167- // await this._fireStoreService.deleteUserData(ngx-auth-firebaseui-user.uid);
168- // }
163+ if ( this . config . enableFirestoreSync ) {
164+ await this . _fireStoreService . deleteUserData ( user . uid ) ;
165+ }
169166 this . onAccountDeleted . emit ( ) ;
170167 this . editMode = false ;
171168 this . snackBar . open ( 'Your account has been successfully deleted!' , 'OK' , {
@@ -178,5 +175,4 @@ export class UserComponent {
178175 } )
179176 }
180177 }
181-
182178}
0 commit comments