WHEN a user is logged in
THEN there should be a button at the top of the weapons section
AND the user should be able to add a weapon
Dev Notes
[x] add a <div> with id="add-new-weapon-modal" to the top of the page, under the nav, but above everything else
[x] add a button under the weapons title in buildAllWeapons with id="add-new-weapon-btn"
[x] use a font awesome plus icon and add-new-weapon
[x] add an event listener to the new button
[x] the event listener should call a function called newWeaponForm
[x] create a new component folder/file called newWeaponForm
[x] create a function in newWeaponForm called newWeaponForm
[x] build out an html bootstrap form using the domString variable
[x] it should have as many inputs as keys in the object, title appropriately
[x] it should have a submit button at the bottom
[x] the submit button has an event listener attached that calls a function named saveNewWeaponItem
[x] in weapons.js create the function saveNewWeaponItem
[x] create addWeapons function in weaponsData.js
[x] uses an axios.post() to send to database
[x] back in saveNewWeaponItem function takes e as a parameter
[x] use e.preventDefault()
[x] then call addWeapon function
[x] .catch() should console.error and comment and the error
[x] .then() should create an object called newWeaponItem with as many key:value pairs as there are keys in the original seed data, plus the uid key that calls the getMyUid function
User Story
As a user I should be able to create a weapon
AC
WHEN a user is logged in THEN there should be a button at the top of the weapons section AND the user should be able to add a weapon
Dev Notes
<div>
withid="add-new-weapon-modal"
to the top of the page, under the nav, but above everything elseweapons
title inbuildAllWeapons
withid="add-new-weapon-btn"
add-new-weapon
newWeaponForm
newWeaponForm
newWeaponForm
callednewWeaponForm
domString
variablesaveNewWeaponItem
weapons.js
create the functionsaveNewWeaponItem
addWeapons
function inweaponsData.js
axios.post()
to send to databasesaveNewWeaponItem
function takese
as a parametere.preventDefault()
addWeapon
function.catch()
should console.error and comment and the error.then()
should create an object callednewWeaponItem
with as manykey:value
pairs as there are keys in the original seed data, plus the uid key that calls thegetMyUid
functionbuildAllWeapons
function