Skip to content

Commit

Permalink
#175: change slice state after deleting a slice
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxue1123 committed May 25, 2022
1 parent d48c163 commit 27d6931
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/SliceViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ export default class SliceViewer extends Component {
await deleteSlice(id);
// toast message to users when the api call is successfully done.
toast.success("Slice deleted successfully.");
window.location.reload();
// change slice state to Dead.
this.setState(prevState => ({
slice: {
...prevState.slice,
"slice_state": "Dead"
}
}))
} catch(ex) {
console.log("failed to delete the slice: " + ex.response.data);
toast.error("Failed to delete the slice.");
Expand Down

0 comments on commit 27d6931

Please sign in to comment.