Blame view
imports/ui/components/authenticated-navigation.js
950 Bytes
2b1ad7917
|
1 |
import React from 'react'; |
7df77f0fa
|
2 |
import { browserHistory } from 'react-router'; |
2b1ad7917
|
3 |
import { Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap'; |
7df77f0fa
|
4 |
import { IndexLinkContainer, LinkContainer } from 'react-router-bootstrap'; |
2b1ad7917
|
5 6 |
const handleLogout = () => { |
7df77f0fa
|
7 |
return Meteor.logout( () => browserHistory.push( '/login' ) ); |
2b1ad7917
|
8 9 10 11 12 |
}; const userName = () => { const user = Meteor.user(); if ( user ) { |
7df77f0fa
|
13 |
const name = user && user.profile ? user.profile.name : ''; |
2b1ad7917
|
14 15 16 |
return `${ name.first } ${ name.last }`; } }; |
7df77f0fa
|
17 |
export const AuthenticatedNavigation = ( { router, location } ) => ( |
2b1ad7917
|
18 19 |
<div> <Nav> |
7df77f0fa
|
20 21 |
<NavItem href="/" eventKey={ 1 }>Index</NavItem> <NavItem href="/dashboard" eventKey={ 2 }>Dashboard</NavItem> |
2b1ad7917
|
22 23 |
</Nav> <Nav pullRight> |
7df77f0fa
|
24 25 |
<NavDropdown eventKey={ 3 } title={ userName() } id="basic-nav-dropdown"> <MenuItem eventKey={ 3.3 } onClick={ handleLogout }>Logout</MenuItem> |
2b1ad7917
|
26 27 28 29 |
</NavDropdown> </Nav> </div> ) |