Skip to content

Commit

Permalink
Fix: Switching orgs using back button. (#1510 - [LL-263](https://lear…
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislav-999 authored Feb 13, 2020
1 parent 2dd3ab6 commit 13ea5fd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/src/pages/HomePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AutoSizer, List as VirtualList, InfiniteLoader } from 'react-virtualize
import { withProps, compose, withState } from 'recompose';
import { actions as routerActions } from 'redux-router5';
import moment from 'moment';
import { isSiteAdminSelector, authenticationSelector, logout, orgLoginStart, loggedInUserSelector } from 'ui/redux/modules/auth';
import { isSiteAdminSelector, authenticationSelector, logout, orgLoginStart, loggedInUserSelector, orgLogout } from 'ui/redux/modules/auth';
import { queryStringToQuery } from 'ui/redux/modules/search';
import { withSchema } from 'ui/utils/hocs';
import Spinner from 'ui/components/Spinner';
Expand All @@ -27,6 +27,7 @@ class Home extends Component {
fetchMore: PropTypes.func,
modelCount: PropTypes.number,
logout: PropTypes.func,
orgLogout: PropTypes.func,
orgLoginStart: PropTypes.func,
navigateTo: PropTypes.func,
isSiteAdmin: PropTypes.bool,
Expand All @@ -42,6 +43,10 @@ class Home extends Component {
isSiteAdmin: false
}

componentDidMount = () => {
this.props.orgLogout();
}

onOrgSearch = (event) => {
this.props.setOrgSearch(event.target.value);
}
Expand Down Expand Up @@ -254,7 +259,7 @@ export default compose(
auth: authenticationSelector(state),
authUser: loggedInUserSelector(state),
isSiteAdmin: isSiteAdminSelector(state)
}), { logout, orgLoginStart, navigateTo: routerActions.navigateTo }),
}), { logout, orgLoginStart, orgLogout, navigateTo: routerActions.navigateTo }),
withState('orgSearch', 'setOrgSearch', ''),
withProps(({ authUser, orgSearch }) => {
const userOrgs = authUser.get('organisations', new ImmutList());
Expand Down

0 comments on commit 13ea5fd

Please sign in to comment.