WHEN a user is logged in
THEN they should be able to see a delete button on all personnel cards
AND they should be able to delete personnel from the database/remove it from the page
Dev Notes
[x] in personnelData.js create a new function called deletePersonnel
[x] make an axios.delete() request
[x] add an id to all of the personnel cards in buildPersonnelCards using a template literal and personnel.id
[x] add a delete button to each card using the buildPersonnelCards function, use font awesome trash can icon, add class="personnel-delete-button"
[x] add an event listener to the delete button using jquery .on() method
[x] in buildAllPersonnel create a new function called removePersonnelCard
[x] takes a single argument of e
[x] declare a variable called personnelId
[x] value is e.target.closest...
[x] call the delete function from personnelData
[x] use .then() to call buildAllPersonnel
[x] then use .catch() to console.error a comment and the error
User Story
as a user I should be able to remove personnel
AC
WHEN a user is logged in THEN they should be able to see a delete button on all personnel cards AND they should be able to delete personnel from the database/remove it from the page
Dev Notes
personnelData.js
create a new function calleddeletePersonnel
axios.delete()
requestbuildPersonnelCards
using a template literal andpersonnel.id
buildPersonnelCards
function, use font awesome trash can icon, addclass="personnel-delete-button"
.on()
methodbuildAllPersonnel
create a new function calledremovePersonnelCard
e
personnelId
e.target.closest...
personnelData
.then()
to callbuildAllPersonnel
.catch()
to console.error a comment and the error