Skip to content

Commit 13ea5fd

Browse files
Fix: Switching orgs using back button. (#1510 - [LL-263](https://learningpool.atlassian.net/browse/LL-263))
1 parent 2dd3ab6 commit 13ea5fd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ui/src/pages/HomePage/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AutoSizer, List as VirtualList, InfiniteLoader } from 'react-virtualize
1111
import { withProps, compose, withState } from 'recompose';
1212
import { actions as routerActions } from 'redux-router5';
1313
import moment from 'moment';
14-
import { isSiteAdminSelector, authenticationSelector, logout, orgLoginStart, loggedInUserSelector } from 'ui/redux/modules/auth';
14+
import { isSiteAdminSelector, authenticationSelector, logout, orgLoginStart, loggedInUserSelector, orgLogout } from 'ui/redux/modules/auth';
1515
import { queryStringToQuery } from 'ui/redux/modules/search';
1616
import { withSchema } from 'ui/utils/hocs';
1717
import Spinner from 'ui/components/Spinner';
@@ -27,6 +27,7 @@ class Home extends Component {
2727
fetchMore: PropTypes.func,
2828
modelCount: PropTypes.number,
2929
logout: PropTypes.func,
30+
orgLogout: PropTypes.func,
3031
orgLoginStart: PropTypes.func,
3132
navigateTo: PropTypes.func,
3233
isSiteAdmin: PropTypes.bool,
@@ -42,6 +43,10 @@ class Home extends Component {
4243
isSiteAdmin: false
4344
}
4445

46+
componentDidMount = () => {
47+
this.props.orgLogout();
48+
}
49+
4550
onOrgSearch = (event) => {
4651
this.props.setOrgSearch(event.target.value);
4752
}
@@ -254,7 +259,7 @@ export default compose(
254259
auth: authenticationSelector(state),
255260
authUser: loggedInUserSelector(state),
256261
isSiteAdmin: isSiteAdminSelector(state)
257-
}), { logout, orgLoginStart, navigateTo: routerActions.navigateTo }),
262+
}), { logout, orgLoginStart, orgLogout, navigateTo: routerActions.navigateTo }),
258263
withState('orgSearch', 'setOrgSearch', ''),
259264
withProps(({ authUser, orgSearch }) => {
260265
const userOrgs = authUser.get('organisations', new ImmutList());

0 commit comments

Comments
 (0)