From 518fb7d9debc871f500b6ac636697e76b35eb687 Mon Sep 17 00:00:00 2001 From: cleverbeagle Date: Thu, 7 Sep 2017 10:11:58 -0500 Subject: [PATCH] move logout functionality to logout page --- .../components/Authenticated/Authenticated.js | 2 +- .../AuthenticatedNavigation.js | 7 ++-- imports/ui/layouts/App/App.js | 2 +- imports/ui/pages/Login/Login.js | 1 - imports/ui/pages/Logout/Logout.js | 38 +++++++++++-------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/imports/ui/components/Authenticated/Authenticated.js b/imports/ui/components/Authenticated/Authenticated.js index 69c2ab5..f34da2f 100644 --- a/imports/ui/components/Authenticated/Authenticated.js +++ b/imports/ui/components/Authenticated/Authenticated.js @@ -9,7 +9,7 @@ const Authenticated = ({ loggingIn, authenticated, component, path, exact, ...re render={props => ( authenticated ? (React.createElement(component, { ...props, ...rest, loggingIn, authenticated })) : - () + () )} /> ); diff --git a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js index d8518b8..c8f6b18 100644 --- a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js +++ b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js @@ -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 }) => (
@@ -27,4 +28,4 @@ AuthenticatedNavigation.propTypes = { name: PropTypes.string.isRequired, }; -export default AuthenticatedNavigation; +export default withRouter(AuthenticatedNavigation); diff --git a/imports/ui/layouts/App/App.js b/imports/ui/layouts/App/App.js index 97a49c5..2be6a1f 100644 --- a/imports/ui/layouts/App/App.js +++ b/imports/ui/layouts/App/App.js @@ -56,7 +56,7 @@ const App = props => ( - + diff --git a/imports/ui/pages/Login/Login.js b/imports/ui/pages/Login/Login.js index 29f4fa2..fb7377f 100644 --- a/imports/ui/pages/Login/Login.js +++ b/imports/ui/pages/Login/Login.js @@ -48,7 +48,6 @@ class Login extends React.Component { Bert.alert(error.reason, 'danger'); } else { Bert.alert('Welcome back!', 'success'); - history.push('/documents'); } }); } diff --git a/imports/ui/pages/Logout/Logout.js b/imports/ui/pages/Logout/Logout.js index 59b3cbe..127c35c 100644 --- a/imports/ui/pages/Logout/Logout.js +++ b/imports/ui/pages/Logout/Logout.js @@ -3,21 +3,29 @@ import Icon from '../../components/Icon/Icon'; import './Logout.scss'; -const Logout = () => ( -
- Clever Beagle -

Stay safe out there.

-

{'Don\'t forget to like and follow Clever Beagle elsewhere on the web:'}

-
    -
  • -
  • -
  • -
-
-); +class Logout extends React.Component { + componentDidMount() { + Meteor.logout(); + } + + render() { + return ( +
+ Clever Beagle +

Stay safe out there.

+

{'Don\'t forget to like and follow Clever Beagle elsewhere on the web:'}

+
    +
  • +
  • +
  • +
+
+ ); + } +} Logout.propTypes = {};