diff --git a/client/components/Profile.js b/client/components/Profile.js index 0cc53bd..96afd0a 100644 --- a/client/components/Profile.js +++ b/client/components/Profile.js @@ -18,12 +18,12 @@ class Profile extends React.Component { this.setVerified = this.setVerified.bind(this); this.setRank = this.setRank.bind(this); + this.grabUserAndFriends = this.grabUserAndFriends.bind(this); } componentDidMount() { - this.props.getUser(this.props.match.params.id) this.props.getLevels() - this.props.getFriends(this.props.match.params.id) + this.grabUserAndFriends(this.props.match.params.id); let completedLevels = 0 if (this.props.user.levels && this.props.user.id) (completedLevels = this.props.user.levels.length) @@ -32,9 +32,11 @@ class Profile extends React.Component { else if (completedLevels <= 9){ this.setRank('Private'); } else if (completedLevels <= 14){ this.setRank('Specialist'); } else if (completedLevels <= 16){ this.setRank('Code Cracker'); } + } - this.props.getFriends() - + async grabUserAndFriends(userId){ + await this.props.getUser(userId); + await this.props.getFriends(this.props.user); } setVerified(bool){ @@ -59,9 +61,8 @@ class Profile extends React.Component {

{this.props.user.username}

{(this.props.auth.id === this.props.user.id) && (verified ? : ) } - {this.props.auth.id !== this.props.user.id && - ()} -

+ {(this.props.auth.id !== this.props.user.id) && ()} +

Next Level:
{this.props.levels[completedLevels] &&