WHEN a user is logged in
THEN they should be able to see a delete button on all weapon cards
AND they should be able to delete a weapon from the database/remove it from the page
Dev Notes
[x] in weaponsData.js create a new function called deleteWeapon
[x] make an axios.delete() request
[x] add an id to all of the weapon cards in buildWeaponCards using a template literal and weapon.id
[x] add a delete button to each card using the buildWeaponCards function, use font awesome trash can icon, add class="weapon-delete-button"
[x] add an event listener to the delete button using jquery .on() method
[x] in buildAllWeapons create a new function called removeWeaponCard
[x] takes a single argument of e
[x] declare a variable called weaponId
[x] value is e.target.closest...
[x] call the delete function from weaponsData
[x] use .then() to call buildAllWeapons
[x] then use .catch() to console.error a comment and the error
User Story
as a user I should be able to delete a weapon
AC
WHEN a user is logged in THEN they should be able to see a delete button on all weapon cards AND they should be able to delete a weapon from the database/remove it from the page
Dev Notes
weaponsData.js
create a new function calleddeleteWeapon
axios.delete()
requestbuildWeaponCards
using a template literal andweapon.id
buildWeaponCards
function, use font awesome trash can icon, addclass="weapon-delete-button"
.on()
methodbuildAllWeapons
create a new function calledremoveWeaponCard
e
weaponId
e.target.closest...
weaponsData
.then()
to callbuildAllWeapons
.catch()
to console.error a comment and the error