0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Initial pass of Account dropdown + LogOut

This commit is contained in:
G.Ambatte
2022-02-08 18:05:02 +13:00
parent 30867960ce
commit c4b0dd5aa6
2 changed files with 34 additions and 3 deletions

View File

@@ -18,11 +18,39 @@ const Account = createClass({
}
},
handleLogout : function(){
if(confirm('Are you sure you want to log out?')) {
document.cookie = `nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;samesite=lax;${window.domain ? `domain=${window.domain}` : ''}`;
window.location = '/';
};
},
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.dropdown>
<Nav.item
className='account'
color='orange'
icon='fas fa-user'
>
{global.account.username}
</Nav.item>
<Nav.item
href={`/user/${global.account.username}`}
color='yellow'
icon='fas fa-user'
>
brews
</Nav.item>
<Nav.item
className='logout'
color='red'
icon='fas fa-power-off'
onClick={this.handleLogout}
>
logout
</Nav.item>
</Nav.dropdown>;
}
return <Nav.item href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`} color='teal' icon='fas fa-sign-in-alt'>

View File

@@ -142,4 +142,7 @@
text-align : center;
}
}
.account.navItem{
min-width: 100px;
}
}