WHEN a user is logged in
THEN they should be able to see a delete button on all enemy cards
AND they should be able to delete an enemy from the database/remove it from the page
Dev Notes
[x] in enemiesData.js create a new function called deleteEnemy
[x] make an axios.delete() request
[x] add an id to all of the enemy cards in buildEnemyCards using a template literal and enemy.id
[x] add a delete button to each card using the buildEnemyCards function, use font awesome trash can icon, add class="enemy-delete-button"
[x] add an event listener to the delete button using jquery .on() method
[x] in buildAllEnemies create a new function called removeEnemyCard
[x] takes a single argument of e
[x] declare a variable called enemyId
[x] value is e.target.closest...
[x] call the delete function from enemiesData
[x] use .then() to call buildAllEnemies
[x] then use .catch() to console.error a comment and the error
User Story
as a user I should be able to delete an enemy
AC
WHEN a user is logged in THEN they should be able to see a delete button on all enemy cards AND they should be able to delete an enemy from the database/remove it from the page
Dev Notes
enemiesData.js
create a new function calleddeleteEnemy
axios.delete()
requestbuildEnemyCards
using a template literal andenemy.id
buildEnemyCards
function, use font awesome trash can icon, addclass="enemy-delete-button"
.on()
methodbuildAllEnemies
create a new function calledremoveEnemyCard
e
enemyId
e.target.closest...
enemiesData
.then()
to callbuildAllEnemies
.catch()
to console.error a comment and the error