mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-03 06:12:51 +00:00
35 lines
743 B
JavaScript
35 lines
743 B
JavaScript
const React = require('react');
|
|
const createClass = require('create-react-class');
|
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
|
|
|
const Account = createClass({
|
|
|
|
getInitialState : function() {
|
|
return {
|
|
url : ''
|
|
};
|
|
},
|
|
|
|
componentDidMount : function(){
|
|
if(typeof window !== 'undefined'){
|
|
this.setState({
|
|
url : window.location.href
|
|
});
|
|
}
|
|
},
|
|
|
|
render : function(){
|
|
if(global.account){
|
|
return <Nav.item href={`/user/${global.account.username}`} color='yellow' icon='fas fa-user'>
|
|
{global.account.username}
|
|
</Nav.item>;
|
|
}
|
|
|
|
return <Nav.item href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`} color='teal' icon='fas fa-sign-in-alt'>
|
|
login
|
|
</Nav.item>;
|
|
}
|
|
});
|
|
|
|
module.exports = Account;
|