Restrict access to the modal for users that are not the owner of the tournament

This commit is contained in:
JP1998 2019-04-09 17:00:49 +02:00
parent 2b1d7b084e
commit 6035da058e
1 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class PrivateTournamentPage extends React.Component {
</Container>
<div className='stages pt-5'>
{playoffStages.map(stage =>
<Stage level={getLevelName(stage.level)} matches={stage.matches} key={stage.level}/>)}
<Stage isSignedIn={isSignedIn} isOwner={username == ownerUsername} level={getLevelName(stage.level)} matches={stage.matches} key={stage.level}/>)}
</div>
</div>
);
@ -113,7 +113,11 @@ class Match extends React.Component {
}
toggleModal() {
this.setState({modal: !this.state.modal});
const { isSignedIn, isOwner } = this.props;
if(isSignedIn && isOwner) {
this.setState({modal: !this.state.modal});
}
}
render() {