Get outta there early if we don't have a user.

This commit is contained in:
joshaber 2016-05-31 14:37:39 -04:00
parent 54babe12ab
commit c9e4b1b629

View file

@ -50,10 +50,15 @@ export default class Info extends React.Component<InfoProps, InfoState> {
} }
public async componentWillMount() { public async componentWillMount() {
if (!this.props.user) {
return Promise.resolve()
}
const api = new Octokat({token: this.props.user.getToken()}) const api = new Octokat({token: this.props.user.getToken()})
const user = await api.user.fetch() const user = await api.user.fetch()
this.setState({userAvatarURL: user.avatarUrl}) this.setState({userAvatarURL: user.avatarUrl})
console.log('user', user) console.log('user', user)
return Promise.resolve()
} }
private renderNoSelection() { private renderNoSelection() {