nss-evening-cohort-10 / nutshell-renaissance-fair

0 stars 0 forks source link

DELETE - Souvenirs #16

Closed phillipsja97 closed 4 years ago

phillipsja97 commented 5 years ago

User Story

As a user, if I am logged in, I should be able to delete a souvenir from the souvenirs page.

AC

WHEN: the page loads a gallery of souvenirs should appear. THEN: the user hovers over a souvenir, a delete button should appear. THEN: if the user is logged in, the user can click on the delete button. THEN: the souvenir is deleted from the page and the database.

Dev Notes

Write an event listener so that -- on hover over a single souvenir card -- a delete button/link appears at the bottom of the card. When the delete button/link is clicked, another event listener is fired that accesses firebase so that the souvenir is deleted from DOM and from firebase.

The delete event listener will call a function that: 1)Grabs the souvenir's id. 2) Makes an axios call to firebase to remove the souvenir's data. The axios call should be in the souvenirData.js file: const deleteSouvenirCard = (souvenirId) => axios.delete(${baseUrl}/souvenirs/${souvenirId}.json); 3) Call the showSouvenirs() function to display the updated souvenirs to the page.

ivannio commented 5 years ago

souvenirs

Souvenir page mockup