Merge pull request #810 from ZmagoD/zd_SCI_1641

trigger redirect to root page on team switch [fixes SCI-1641]
This commit is contained in:
Zmago Devetak 2017-10-06 17:06:06 +02:00 committed by GitHub
commit 395d0cb863

View file

@ -6,6 +6,7 @@ import { NavDropdown, MenuItem, Glyphicon } from "react-bootstrap";
import styled from "styled-components"; import styled from "styled-components";
import _ from "lodash"; import _ from "lodash";
import { ROOT_PATH } from "../../../config/routes";
import { BORDER_GRAY_COLOR } from "../../../config/constants/colors"; import { BORDER_GRAY_COLOR } from "../../../config/constants/colors";
import { changeTeam } from "../../actions/TeamsActions"; import { changeTeam } from "../../actions/TeamsActions";
import { getTeamsList } from "../../actions/TeamsActions"; import { getTeamsList } from "../../actions/TeamsActions";
@ -27,15 +28,18 @@ class TeamSwitch extends Component {
changeTeam(teamId) { changeTeam(teamId) {
this.props.changeTeam(teamId); this.props.changeTeam(teamId);
window.location = ROOT_PATH;
} }
displayTeams() { displayTeams() {
if (!_.isEmpty(this.props.all_teams)) { if (!_.isEmpty(this.props.all_teams)) {
return this.props.all_teams.filter(team => !team.current_team).map(team => return this.props.all_teams
<MenuItem onSelect={() => this.changeTeam(team.id)} key={team.id}> .filter(team => !team.current_team)
{team.name} .map(team => (
</MenuItem> <MenuItem onSelect={() => this.changeTeam(team.id)} key={team.id}>
); {team.name}
</MenuItem>
));
} }
} }