mattermost-mobile/app/components/push_notification/index.js
2017-04-10 11:33:35 -03:00

36 lines
1 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {goToNotification, queueNotification} from 'app/actions/views/root';
import {setDeviceToken} from 'mattermost-redux/actions/general';
import {getUnreads} from 'mattermost-redux/selectors/entities/channels';
import PushNotification from './push_notification';
function mapStateToProps(state, ownProps) {
const {currentTeamId, teams} = state.entities.teams;
const {currentChannelId} = state.entities.channels;
return {
...ownProps,
currentTeamId,
currentChannelId,
teams,
...getUnreads(state)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
goToNotification,
queueNotification,
setDeviceToken
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(PushNotification);