diff --git a/js/components/Match.js b/js/components/Match.js
index f12481e..95293d8 100644
--- a/js/components/Match.js
+++ b/js/components/Match.js
@@ -21,6 +21,7 @@ export class Match extends React.Component {
this.onEndMatchSuccess = this.onEndMatchSuccess.bind(this);
this.onEndMatchError = this.onEndMatchError.bind(this);
this.getMatchFinishedMessage = this.getMatchFinishedMessage.bind(this);
+ this.changeScores = this.changeScores.bind(this);
}
toggleModal() {
@@ -64,6 +65,13 @@ export class Match extends React.Component {
notify.show('Das Match konnte nicht beendet werden.', 'error', 3000);
}
+ changeScores(scoreTeam1, scoreTeam2) {
+ const updatedMatch = this.state.match;
+ updatedMatch.team1.score = scoreTeam1;
+ updatedMatch.team2.score = scoreTeam2;
+ this.setState({match: updatedMatch});
+ }
+
getMatchFinishedMessage() {
const match = this.state.match;
if (match.winnerTeamId === null) {
@@ -114,7 +122,7 @@ export class Match extends React.Component {
{smallMessage}
+ startMatch={this.startMatch} endMatch={this.endMatch} changeScores={this.changeScores}/>
);
}
}
diff --git a/js/components/MatchModal.js b/js/components/MatchModal.js
index fd5b81f..824a8fe 100644
--- a/js/components/MatchModal.js
+++ b/js/components/MatchModal.js
@@ -37,6 +37,7 @@ export class MatchModal extends Component {
onSubmitScoresSuccess() {
this.props.toggle();
+ this.props.changeScores(this.state.scoreTeam1, this.state.scoreTeam2);
notify.show('Der Spielstand wurde geƤndert.', 'success', 2000);
}