PLT-6213 Move team store and actions over to use redux (#6222)
* Move team store and actions over to user redux * Fix JS error when inviting by email
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1fef5bf5fe
Коммит
7307156c49
24
webapp/components/team_sidebar/index.js
Обычный файл
24
webapp/components/team_sidebar/index.js
Обычный файл
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import {connect} from 'react-redux';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {getTeams} from 'mattermost-redux/actions/teams';
|
||||
|
||||
import TeamSidebar from './team_sidebar_controller.jsx';
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
return {
|
||||
...ownProps
|
||||
};
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
actions: bindActionCreators({
|
||||
getTeams
|
||||
}, dispatch)
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TeamSidebar);
|
||||
@@ -6,7 +6,6 @@ import TeamButton from './components/team_button.jsx';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import {sortTeamsByDisplayName} from 'utils/team_utils.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
@@ -15,6 +14,12 @@ import React from 'react';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
|
||||
export default class TeamSidebar extends React.Component {
|
||||
static propTypes = {
|
||||
actions: React.PropTypes.shape({
|
||||
getTeams: React.PropTypes.func.isRequired
|
||||
}).isRequired
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
@@ -44,7 +49,7 @@ export default class TeamSidebar extends React.Component {
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
TeamStore.addChangeListener(this.onChange);
|
||||
TeamStore.addUnreadChangeListener(this.onChange);
|
||||
AsyncClient.getAllTeamListings();
|
||||
this.props.actions.getTeams(0, 200);
|
||||
this.setStyles();
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user