Closed Nikababy01 closed 4 years ago
As a user, I should be able to edit a Weapon.
WHEN the page loads I should see all boards THEN click a button to see all pins AND click a button to return back to my boards
1. In weaponsData.js create a single weapon function: const getSingleWeapon = (weaponId) => axios.get(`${baseUrl}/weapons/${weaponId}.json`); export {getSingleWeapon} 2. Use a bootstrap form and create a component editWeapon add a domstring with the bootstrap form: import utils from '../../helpers/utils'; import weaponsData from '../../helpers/data/weaponsData'; const showForm = (weaponsId) => { weaponsData.getSingleWeapon(weaponId) .then((resp) => { const weapon = resp.data; let domString = ''; domString += '<h2 class="text-center">Edit Weapon</h2>'; domString += `<form class="col-10 offset-1 edit-weapon-form-tag" id=${weaponId}>`; domString += '</form>; utils.printToDom('edit-weapon', domString); 2. In weaponData.js add a function to edit the weapons const updateWeapon = (weaponId, modifiedWeapon) => axios.put(`${baseUrl}/weapons/${weaponsId}.json`, modifiedWeapon); 3. create an event listener in weapons.js const editWeaponsEvent = (e) => { e.preventDefault(); const weaponsId = e.target.closest('.card').id; editWeapon.showForm(weaponId); };
EX. #1
USER STORY
As a user, I should be able to edit a Weapon.
AC
WHEN the page loads I should see all boards THEN click a button to see all pins AND click a button to return back to my boards
WIREFRAMES
DEV NOTES
RELATED TICKETS
EX. #1