forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (31 loc) · 1.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {removeUserFromTeam as leaveTeam} from 'mattermost-redux/actions/teams';
import {toggleSideBarRightMenuAction} from 'actions/global_actions.jsx';
import {ModalIdentifiers} from 'utils/constants';
import {isModalOpen} from 'selectors/views/modals';
import LeaveTeamModal from './leave_team_modal.jsx';
function mapStateToProps(state) {
const modalId = ModalIdentifiers.LEAVE_TEAM;
const currentUserId = getCurrentUserId(state);
const currentTeamId = getCurrentTeamId(state);
const show = isModalOpen(state, modalId);
return {
currentUserId,
currentTeamId,
show,
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
leaveTeam,
toggleSideBarRightMenu: toggleSideBarRightMenuAction,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(LeaveTeamModal);