Skip to content

Commit 81adcfd

Browse files
committed
Add window.confirm on thesis deletion to prevent accidents
1 parent 6d9ffb9 commit 81adcfd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

frontend/src/containers/Thesis/ThesisList.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export class ThesisList extends Component {
3030
}
3131
}
3232

33+
handleThesisDelete(thesisId) {
34+
if (!window.confirm('Are you sure you want to delete this thesis?')) return
35+
this.props.deleteThesis(thesisId)
36+
}
37+
3338
toggleThesis = thesis => () => {
3439
const selectedThesesIds = this.state.selectedThesesIds.includes(thesis.thesisId) ?
3540
this.state.selectedThesesIds.filter(id => id !== thesis.thesisId) :
@@ -179,7 +184,7 @@ export class ThesisList extends Component {
179184
showButtons={this.props.showButtons}
180185
selectable={this.props.selectable}
181186
selectedThesesIds={this.state.selectedThesesIds}
182-
onDelete={() => this.props.deleteThesis(thesis.thesisId)}
187+
onDelete={() => this.handleThesisDelete(thesis.thesisId)}
183188
/>
184189
))}
185190
</tbody>

0 commit comments

Comments
 (0)