1
1
import { Component , OnInit } from '@angular/core' ;
2
2
import { ActivatedRoute , Params } from '@angular/router' ;
3
- import { FormGroup , ReactiveFormsModule } from '@angular/forms' ;
4
3
import { trigger , state , style , transition , animate , keyframes } from '@angular/animations' ;
4
+
5
5
import * as firebase from 'firebase' ;
6
6
7
7
import { User , Profile , UserService , AlertService } from '../shared' ;
@@ -28,35 +28,23 @@ import { User, Profile, UserService, AlertService } from '../shared';
28
28
]
29
29
} )
30
30
export class ProfileComponent implements OnInit {
31
- profile : Profile ;
32
- currentUser : User ;
33
- user : { uid : any } ;
34
31
uid = firebase . auth ( ) . currentUser . uid ;
35
32
36
33
fullImagePath : string ;
37
34
profileTitle : string = 'My profile' ;
38
- displayName : any ;
39
- bio : any ;
35
+ displayName : string = "Your username" ;
36
+ bio : any = "Your bio" ;
40
37
41
38
state = 'small' ;
42
39
43
- constructor ( private route : ActivatedRoute ,
44
- private userService : UserService ,
45
- private alertService : AlertService ) {
46
- this . fullImagePath = '/assets/img/mb-bg-04.png' ;
40
+ constructor (
41
+ private route : ActivatedRoute ,
42
+ private userService : UserService ,
43
+ private alertService : AlertService ) {
44
+ this . fullImagePath = '/assets/img/mb-bg-04.png' ;
47
45
}
48
46
49
47
ngOnInit ( ) {
50
- this . user = {
51
- uid : this . route . snapshot . params [ 'uid' ]
52
- } ;
53
- this . route . params
54
- . subscribe (
55
- ( params : Params ) => {
56
- this . user . uid = params [ 'uid' ] ;
57
- }
58
- ) ;
59
-
60
48
firebase . database ( ) . ref ( ) . child ( 'users/' + this . uid ) . once ( 'value' ) . then ( ( snap ) => {
61
49
this . displayName = snap . val ( ) . displayName ,
62
50
this . bio = snap . val ( ) . bio
@@ -72,11 +60,6 @@ export class ProfileComponent implements OnInit {
72
60
return firebase . auth ( ) . currentUser . email ;
73
61
}
74
62
75
- userName ( ) {
76
- this . userService . getUserProfileInformation ( ) ;
77
- return firebase . auth ( ) . currentUser . displayName ;
78
- }
79
-
80
63
onPasswordReset ( ) {
81
64
this . userService . sendUserPasswordResetEmail ( ) ;
82
65
this . alertService . showToaster ( 'Reset password is sent to your email' ) ;
0 commit comments