WHEN a user is logged in
THEN there should be a button at the top of the enemy section
AND the user should be able to add an enemy
Dev Notes
[x] add a <div> with id="add-new-enemy-modal" to the top of the page, under the nav, but above everything else
[x] add a button under the enemies title in buildAllEnemies with id="add-new-enemy-btn"
[x] use a font awesome plus icon and add-new-enemy
[x] add an event listener to the new button
[x] the event listener should call a function called newEnemyForm
[x] create a new component folder/file called newEnemyForm
[x] create a function in newEnemyForm called newEnemyForm
[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 saveNewEnemyItem
[x] in enemies.js create the function saveNewEnemyItem
[x] create addEnemy function in enemiesData.js
[x] uses an axios.post() to send to database
[x] back in saveNewEnemyItem function takes e as a parameter
[x] use e.preventDefault()
[x] then call addEnemy function
[x] .catch() should console.error and comment and the error
[x] .then() should create an object called newEnemyItem 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 an enemy
AC
WHEN a user is logged in THEN there should be a button at the top of the enemy section AND the user should be able to add an enemy
Dev Notes
<div>
withid="add-new-enemy-modal"
to the top of the page, under the nav, but above everything elseenemies
title inbuildAllEnemies
withid="add-new-enemy-btn"
add-new-enemy
newEnemyForm
newEnemyForm
newEnemyForm
callednewEnemyForm
domString
variablesaveNewEnemyItem
enemies.js
create the functionsaveNewEnemyItem
addEnemy
function inenemiesData.js
axios.post()
to send to databasesaveNewEnemyItem
function takese
as a parametere.preventDefault()
addEnemy
function.catch()
should console.error and comment and the error.then()
should create an object callednewEnemyItem
with as manykey:value
pairs as there are keys in the original seed data, plus the uid key that calls thegetMyUid
functionbuildAllEnemies
function