Skip to content

DEV - delete grant connected to backend + useEffect for deleting AND editing #197

@lyannne

Description

@lyannne

Description: Now that the expanded view is set up (shoutout Josie!), we want to add in the delete functionality, with the route Camila built in #189. The goal of this ticket is to add the button into the bottom of the expanded view, as shown in the design below, which causes an "are you sure" modal to pop up; that modal then calls the delete backend route, then re-calls the getAllGrantsroute to re-fetch updated version for store.

Design:

Image

Success Critera:

  • Delete button is created and added to the expanded grant view
  • Button causes a modal to pop up (UPDATE: DESIGN IS IN FIGMA! THIS COMPONENT SHOULD TAKE IN PROPS, SINCE THIS COMPONENT WILL ALSO BE THE MODAL THAT POPS UP WHEN AN ADMIN TRIES TO DELETE A USER OR CHANGE A USER'S ROLE. you can call it something like areYouSureModal.tsx or something like that)
    • Image
    • the "yes" button in that modal is connected to the backend and calls the deleteGrant route, and then will also trigger the useEffect after deleting the grant in the store using what is returned from the backend
    • the "no" button just closes the modal and causes no other changes.
    • HOW TO ABSTRACT IT: Pass in a button, pass in text
  • After user confirms deleting, the getAllGrants route is called to update the store, and the changes are reflected immediately in the frontend
    • e.g. if a grant is deleted, the grant is no longer displayed

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions