diff options
Diffstat (limited to 'webapp/components/team_sidebar')
-rw-r--r-- | webapp/components/team_sidebar/components/team_button.jsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/webapp/components/team_sidebar/components/team_button.jsx b/webapp/components/team_sidebar/components/team_button.jsx index 2df21b20b..6fbf8aef9 100644 --- a/webapp/components/team_sidebar/components/team_button.jsx +++ b/webapp/components/team_sidebar/components/team_button.jsx @@ -3,6 +3,8 @@ import Constants from 'utils/constants.jsx'; +import {switchTeams} from 'actions/team_actions.jsx'; + import React from 'react'; import {Link} from 'react-router/es6'; import {Tooltip, OverlayTrigger} from 'react-bootstrap'; @@ -11,9 +13,15 @@ export default class TeamButton extends React.Component { constructor(props) { super(props); + this.handleSwitch = this.handleSwitch.bind(this); this.handleDisabled = this.handleDisabled.bind(this); } + handleSwitch(e) { + e.preventDefault(); + switchTeams(this.props.url); + } + handleDisabled(e) { e.preventDefault(); } @@ -22,7 +30,7 @@ export default class TeamButton extends React.Component { let teamClass = this.props.active ? 'active' : ''; const btnClass = this.props.btnClass; const disabled = this.props.disabled ? 'team-disabled' : ''; - const handleClick = (this.props.active || this.props.disabled) ? this.handleDisabled : null; + const handleClick = (this.props.active || this.props.disabled) ? this.handleDisabled : this.handleSwitch; let badge; if (!teamClass) { |