Commit 06983cad authored by Anton Akhmerov's avatar Anton Akhmerov

navigate away from the deleted exam

parent 72eb8cbb
Pipeline #10762 passed with stages
in 2 minutes 5 seconds
......@@ -72,11 +72,11 @@ class App extends React.Component {
}
deleteExam = (examID) => {
api
return api
.del('exams/' + examID)
.then(() => {
if (this.menu.current) {
return this.menu.current.updateExamList()
this.menu.current.updateExamList()
}
})
}
......@@ -143,7 +143,8 @@ class App extends React.Component {
examID={match.params.examID}
updateExam={this.updateExam}
deleteExam={this.deleteExam}
updateSubmission={this.updateSubmission} />} />
updateSubmission={this.updateSubmission}
leave={() => history.push('/')} />} />
<Route path='/exams' render={({ history }) =>
<AddExam updateExamList={this.menu.current ? this.menu.current.updateExamList : null} changeURL={history.push} />} />
<Route path='/submissions/:examID' render={({ match }) =>
......
......@@ -316,9 +316,7 @@ class Exams extends React.Component {
previewing: true
})}
/>,
<this.Delete
onDeleteClicked={() => this.props.deleteExam(this.props.examID)}
/>
<this.Delete />
</div>
}
......@@ -405,7 +403,10 @@ class Exams extends React.Component {
</section>
<ConfirmationModal active={this.state.deleting} color='is-danger'
confirmText='Delete exam' onCancel={() => this.setState({deleting: false})}
onConfirm={this.onDeleteClicked} />
onConfirm={() => {
this.props.deleteExam(this.props.examID).then(this.props.leave)
}}
/>
</div>
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment