Created
June 7, 2018 17:42
-
-
Save kmikulski/a92de0d5318fd550cd3b0f5cb2d3ff8c to your computer and use it in GitHub Desktop.
the description for this gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class UserInfo extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
name: "", | |
email: "", | |
id: "" | |
}; | |
this.props.keycloak.loadUserInfo().then(userInfo => { | |
this.setState({name: userInfo.name, email: userInfo.email, id: userInfo.sub}) | |
}); | |
} | |
render() { | |
return ( | |
<div className="UserInfo"> | |
<p>Name: {this.state.name}</p> | |
<p>Email: {this.state.email}</p> | |
<p>ID: {this.state.id}</p> | |
</div> | |
); | |
} | |
} | |
export default UserInfo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment