WHEN the page loads I should see the weapons
THEN click a button
AND add a new weapon
WIREFRAMES
DEV NOTES
1. In weapons.js create a function to add a new weapon:
const makeNewWeapon = (e) => {
e.preventDefault();
const newWeapon = {
name: $('#new-weapon-name').val(),
description: $('#weapon-description).val(),
};
weaponsData.addWeapons(newWeapon)
.then(()= > {
buildWeaponsCards();
utils.printToDom('newWeapon', '')
})
.catch((err) => console.error('could not add weapon', err));
};
1. Create a bootstrap button
2. In weaponsData.js :
import axios from 'axios';
import apiKeys from '../apiKeys.json';
3. add a function to post to firebase:
const addWeapons = (newWeapon) => axios.post(`baseUrl}/weapons/.json`, newWeapon);
USER STORY
As a user, I should be able to create a Weapon.
AC
WHEN the page loads I should see the weapons THEN click a button
AND add a new weapon
WIREFRAMES
DEV NOTES
RELATED TICKETS
EX. #4