fixed nav bar dropdown to stay on channel when view is selected
This commit is contained in:
parent
5f70cdd979
commit
74b6bca16c
3 changed files with 9 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
function NavBarChannelOptionsDropdown ({ channelName, handleSelection, VIEW, LOGOUT }) {
|
||||
function NavBarChannelDropdown ({ channelName, handleSelection, defaultSelection, VIEW, LOGOUT }) {
|
||||
return (
|
||||
<select type="text" id="nav-bar-channel-select" className="select select--arrow link--nav" onChange={handleSelection}>
|
||||
<select type="text" id="nav-bar-channel-select" className="select select--arrow link--nav" onChange={handleSelection} value={defaultSelection}>
|
||||
<option id="nav-bar-channel-select-channel-option">{channelName}</option>
|
||||
<option value={VIEW}>View</option>
|
||||
<option value={LOGOUT}>Logout</option>
|
||||
|
@ -10,4 +10,4 @@ function NavBarChannelOptionsDropdown ({ channelName, handleSelection, VIEW, LOG
|
|||
);
|
||||
};
|
||||
|
||||
export default NavBarChannelOptionsDropdown;
|
||||
export default NavBarChannelDropdown;
|
||||
|
|
|
@ -17,6 +17,9 @@ const mapDispatchToProps = dispatch => {
|
|||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
dispatch(updateSelectedChannel(name));
|
||||
},
|
||||
onChannelLogout: () => {
|
||||
dispatch(updateLoggedInChannel(null, null, null));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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 {
|
|||
<NavBarChannelDropdown
|
||||
channelName={this.props.channelName}
|
||||
handleSelection={this.handleSelection}
|
||||
defaultSelection={this.props.channelName}
|
||||
VIEW={VIEW}
|
||||
LOGOUT={LOGOUT}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue