File size: 862 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import ProfileCover from './profile_cover';
import ProfileContent from './profile_content';

class Profile extends React.Component {
  componentDidMount() {
    this.props.requestUserByUrl(this.props.userUrl);
  }

  componentDidUpdate(prevProps) {
    if (prevProps.match.params.userUrl !== this.props.match.params.userUrl) {
      this.props.requestUserByUrl(this.props.userUrl);
    }
  }

  render() {
    if (this.props.user === undefined) {
      return <div></div>
    } else {
      return (
        <div className="profile-container">
          <ProfileCover 
            currentUserId={this.props.currentUserId} 
            user={this.props.user} 
            updatePhoto={this.props.updatePhoto}
            />
          <ProfileContent user={this.props.user}/>
        </div>
      )
    }

  }
}

export default Profile;