summaryrefslogtreecommitdiffstats
path: root/webapp/components/integrations/components/installed_oauth_apps/index.js
blob: bfeed6d66d8f1fe8e65b1c6dc46e74bf518a794b (plain)
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
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as Actions from 'mattermost-redux/actions/integrations';
import {getOAuthApps} from 'mattermost-redux/selectors/entities/integrations';
import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';

import InstalledOAuthApps from './installed_oauth_apps.jsx';

function mapStateToProps(state, ownProps) {
    return {
        ...ownProps,
        oauthApps: getOAuthApps(state),
        isSystemAdmin: isCurrentUserSystemAdmin(state),
        regenOAuthAppSecretRequest: state.requests.integrations.updateOAuthApp
    };
}

function mapDispatchToProps(dispatch) {
    return {
        actions: bindActionCreators({
            getOAuthApps: Actions.getOAuthApps,
            regenOAuthAppSecret: Actions.regenOAuthAppSecret,
            deleteOAuthApp: Actions.deleteOAuthApp
        }, dispatch)
    };
}

export default connect(mapStateToProps, mapDispatchToProps)(InstalledOAuthApps);