This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
index.ts
41 lines (30 loc) · 1.49 KB
/
index.ts
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
39
40
41
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux';
import {getAllChannels as loadChannels, searchAllChannels} from 'mattermost-redux/actions/channels';
import {ChannelWithTeamData, ChannelSearchOpts} from 'mattermost-redux/types/channels';
import {ActionFunc, ActionResult, GenericAction} from 'mattermost-redux/types/actions';
import {setModalSearchTerm} from 'actions/views/search';
import {GlobalState} from '../../types/store';
import ChannelSelectorModal from './channel_selector_modal';
type Actions = {
loadChannels: (page?: number, perPage?: number, notAssociatedToGroup?: string, excludeDefaultChannels?: boolean) => Promise<{data: ChannelWithTeamData[]}>;
setModalSearchTerm: (term: string) => ActionResult;
searchAllChannels: (term: string, opts?: ChannelSearchOpts) => Promise<{data: ChannelWithTeamData[]}>;
}
function mapStateToProps(state: GlobalState) {
return {
searchTerm: state.views.search.modalSearch,
};
}
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
return {
actions: bindActionCreators<ActionCreatorsMapObject<ActionFunc|GenericAction>, Actions>({
loadChannels,
setModalSearchTerm,
searchAllChannels,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(ChannelSelectorModal);