From 74b6bca16c390d829653cb1e90ee60c09861e371 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Fri, 2 Feb 2018 14:48:04 -0800 Subject: [PATCH] fixed nav bar dropdown to stay on channel when view is selected --- react/components/NavBarChannelOptionsDropdown/index.jsx | 6 +++--- react/containers/NavBar/index.js | 3 +++ react/containers/NavBar/view.jsx | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/react/components/NavBarChannelOptionsDropdown/index.jsx b/react/components/NavBarChannelOptionsDropdown/index.jsx index 0ea68531..08b285f0 100644 --- a/react/components/NavBarChannelOptionsDropdown/index.jsx +++ b/react/components/NavBarChannelOptionsDropdown/index.jsx @@ -1,8 +1,8 @@ import React from 'react'; -function NavBarChannelOptionsDropdown ({ channelName, handleSelection, VIEW, LOGOUT }) { +function NavBarChannelDropdown ({ channelName, handleSelection, defaultSelection, VIEW, LOGOUT }) { return ( - @@ -10,4 +10,4 @@ function NavBarChannelOptionsDropdown ({ channelName, handleSelection, VIEW, LOG ); }; -export default NavBarChannelOptionsDropdown; +export default NavBarChannelDropdown; diff --git a/react/containers/NavBar/index.js b/react/containers/NavBar/index.js index 82a6080d..80689d97 100644 --- a/react/containers/NavBar/index.js +++ b/react/containers/NavBar/index.js @@ -17,6 +17,9 @@ const mapDispatchToProps = dispatch => { dispatch(updateLoggedInChannel(name, shortId, longId)); dispatch(updateSelectedChannel(name)); }, + onChannelLogout: () => { + dispatch(updateLoggedInChannel(null, null, null)); + }, }; }; diff --git a/react/containers/NavBar/view.jsx b/react/containers/NavBar/view.jsx index 7ff11cf6..b2ff20b3 100644 --- a/react/containers/NavBar/view.jsx +++ b/react/containers/NavBar/view.jsx @@ -19,7 +19,6 @@ class NavBar extends React.Component { this.checkForLoggedInUser(); } checkForLoggedInUser () { - // check for whether a channel is already logged in const params = { credentials: 'include', } @@ -37,7 +36,8 @@ class NavBar extends React.Component { } logoutUser () { // send logout request to server - window.location.href = '/logout'; // NOTE: replace with a call to the server + window.location.href = '/logout'; // NOTE: replace with a call to the server that does not redirect + // this.props.onChannelLogout() } handleSelection (event) { console.log('handling selection', event); @@ -70,6 +70,7 @@ class NavBar extends React.Component {