move logout functionality to logout page

This commit is contained in:
cleverbeagle 2017-09-07 10:11:58 -05:00
parent f308d32739
commit 518fb7d9de
5 changed files with 29 additions and 21 deletions

View file

@ -9,7 +9,7 @@ const Authenticated = ({ loggingIn, authenticated, component, path, exact, ...re
render={props => (
authenticated ?
(React.createElement(component, { ...props, ...rest, loggingIn, authenticated })) :
(<Redirect to="/logout" />)
(<Redirect to="/login" />)
)}
/>
);

View file

@ -1,10 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
import { LinkContainer } from 'react-router-bootstrap';
import { Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap';
import { Meteor } from 'meteor/meteor';
const AuthenticatedNavigation = ({ name }) => (
const AuthenticatedNavigation = ({ name, history }) => (
<div>
<Nav>
<LinkContainer to="/documents">
@ -17,7 +18,7 @@ const AuthenticatedNavigation = ({ name }) => (
<NavItem eventKey={2.1} href="/profile">Profile</NavItem>
</LinkContainer>
<MenuItem divider />
<MenuItem eventKey={2.2} onClick={() => Meteor.logout()}>Logout</MenuItem>
<MenuItem eventKey={2.2} onClick={() => history.push('/logout')}>Logout</MenuItem>
</NavDropdown>
</Nav>
</div>
@ -27,4 +28,4 @@ AuthenticatedNavigation.propTypes = {
name: PropTypes.string.isRequired,
};
export default AuthenticatedNavigation;
export default withRouter(AuthenticatedNavigation);