A user should be protected from accidentally deleting a story. When a user clicks the trash can icon on a story, they are redirected to a modal that provides a second prompt verifying that the user actually wants to delete the story.
Technical Notes
I was unable to pass story object as a prop to the modal directly. I was able to resolve this problem by creating a new slice of state called focused_item. Whenever the delete modal is prompted, the app calls the fetchStory action, which returns an object RECEIVE_STORY to the focused_item_reducer.
The focused_item_reducer should be flexible, and possibly usable for deleting other objects like projects and/or users via a modal.
Summary
A user should be protected from accidentally deleting a story. When a user clicks the trash can icon on a story, they are redirected to a modal that provides a second prompt verifying that the user actually wants to delete the story.
Technical Notes
I was unable to pass story object as a prop to the modal directly. I was able to resolve this problem by creating a new slice of state called
focused_item
. Whenever the delete modal is prompted, the app calls thefetchStory
action, which returns an objectRECEIVE_STORY
to thefocused_item_reducer
.The
focused_item_reducer
should be flexible, and possibly usable for deleting other objects like projects and/or users via a modal.