Closed Nikababy01 closed 4 years ago
As a user, I should be able to view all Weapons.boards.
WHEN the page loads I should see all boards THEN click a board by weapons type AND will view all weapons information
Create a axios.get function in weaponsData.js to get id const getWeaponsByid
const getWeaponsbyId = (weaponsId) =>new Promise (resolve, reject) => { axios.get(`${baseUrl}/weapons.json? orderBy= "weaponsId"&equalTo="${weaponsId}"`) .then((response) => { const myWeapons= response.data; const weapons = []; Object.keys(myWeapons).forEach((weaponsId) => { myWeapons[weaponsId].id = weaponsId; weapons.push(myWeapons[weaponsId]); }); resolve(weapons); }) .catch(err) => reject(err)); }); export default { getWeaponsbyId };
2. Create a domString to build the cards for the weaponsCard in a component ** weapons.js** **const buildWeaponsCards** ```<ADD FUNCTION HERE> const buildWeaponsCards =() => { weaponsData.getWeaponsById(weaponsId) .then ((weapons) => { let domString = ' '; domString += 'h2 class= "text-center">Weapons</h2>; domString += '<div class="d-flex flex-wrap">'; weapons.forEach((weapon)=>{ domString += weaponsComponent.weaponsMaker(weapon); }); domString += '<div>'; utils.printToDom('weapons', domString);
3. Send this to the **printToDom** in **utils.js**
EX. #4
USER STORY
As a user, I should be able to view all Weapons.boards.
AC
WHEN the page loads I should see all boards THEN click a board by weapons type AND will view all weapons information
WIREFRAMES
DEV NOTES
Create a axios.get function in weaponsData.js to get id const getWeaponsByid
RELATED TICKETS
EX. #4