Skip to content

Commit

Permalink
Add window.confirm on thesis deletion to prevent accidents
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksTeresh committed Mar 21, 2024
1 parent 6d9ffb9 commit 81adcfd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/containers/Thesis/ThesisList.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export class ThesisList extends Component {
}
}

handleThesisDelete(thesisId) {
if (!window.confirm('Are you sure you want to delete this thesis?')) return
this.props.deleteThesis(thesisId)
}

toggleThesis = thesis => () => {
const selectedThesesIds = this.state.selectedThesesIds.includes(thesis.thesisId) ?
this.state.selectedThesesIds.filter(id => id !== thesis.thesisId) :
Expand Down Expand Up @@ -179,7 +184,7 @@ export class ThesisList extends Component {
showButtons={this.props.showButtons}
selectable={this.props.selectable}
selectedThesesIds={this.state.selectedThesesIds}
onDelete={() => this.props.deleteThesis(thesis.thesisId)}
onDelete={() => this.handleThesisDelete(thesis.thesisId)}
/>
))}
</tbody>
Expand Down

0 comments on commit 81adcfd

Please sign in to comment.