Closed Nikababy01 closed 4 years ago
As a user, I should be able to delete a Weapon.
WHEN the page loads I should see all weapons THEN click a button to delete AND can see that it deleted
1. Create a bootstrap button const completelyRemoveWeapon = (weaponId) => new Promise((resolve, reject) => { weaponsData.deleteWeapon(weaponId) .then(() => { weaponsData.getWeaponsById(weaponId).then((weaponId) => { weapons.forEach((weapons) => { weaponsData.deleteweapons(weapon.id); }); resolve(); }); }) .catch((err) => reject(err)); 2. const deleteWeapon = (weaponId) => axios.delete(`${baseUrl}/weapons/${weaponsId}.json`); 3. In weapons.js const removeWeapons = (e) => { const weaponId = e.target.closest('.card').id; weaponsData.completelyRemoveWeapons(weaponsId) .then(() => { // eslint-disable-next-line no-use-before-define buildWeapons(); utils.printToDom('single-weapon', ''); }) .catch((err) => console.error('could not delete weapon', err)); };
EX. #4
USER STORY
As a user, I should be able to delete a Weapon.
AC
WHEN the page loads I should see all weapons THEN click a button to delete AND can see that it deleted
WIREFRAMES
DEV NOTES
RELATED TICKETS
EX. #4