Show an alert box when the team could not be joined (#2462)
This commit is contained in:
parent
af8faa8a2c
commit
a8224e2b42
3 changed files with 3 additions and 10 deletions
|
|
@ -31,7 +31,6 @@ function mapStateToProps(state) {
|
|||
teamsRequest: state.requests.teams.getTeams,
|
||||
teams: Object.values(getJoinableTeams(state)).sort(sortTeams),
|
||||
currentChannelId: getCurrentChannelId(state),
|
||||
joinTeamRequest: state.requests.teams.joinTeam,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ export default class SelectTeam extends PureComponent {
|
|||
}).isRequired,
|
||||
currentChannelId: PropTypes.string,
|
||||
currentUrl: PropTypes.string.isRequired,
|
||||
joinTeamRequest: PropTypes.object.isRequired,
|
||||
navigator: PropTypes.object,
|
||||
userWithoutTeams: PropTypes.bool,
|
||||
teams: PropTypes.array.isRequired,
|
||||
|
|
@ -81,11 +80,6 @@ export default class SelectTeam extends PureComponent {
|
|||
if (this.props.teams !== nextProps.teams) {
|
||||
this.buildData(nextProps);
|
||||
}
|
||||
|
||||
if (this.props.joinTeamRequest.status !== RequestStatus.FAILURE &&
|
||||
nextProps.joinTeamRequest.status === RequestStatus.FAILURE) {
|
||||
Alert.alert('', nextProps.joinTeamRequest.error.message);
|
||||
}
|
||||
}
|
||||
|
||||
getTeams = () => {
|
||||
|
|
@ -160,8 +154,9 @@ export default class SelectTeam extends PureComponent {
|
|||
markChannelAsRead(currentChannelId);
|
||||
}
|
||||
|
||||
const success = await joinTeam(team.invite_id, team.id);
|
||||
if (!success) {
|
||||
const {error} = await joinTeam(team.invite_id, team.id);
|
||||
if (error) {
|
||||
Alert.alert(error.message);
|
||||
this.setState({joining: false});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ describe('SelectTeam', () => {
|
|||
actions,
|
||||
currentChannelId: 'someId',
|
||||
currentUrl: 'test',
|
||||
joinTeamRequest: {},
|
||||
navigator: {
|
||||
setOnNavigatorEvent: jest.fn(),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue