As a user, I should be able to edit the enemy target for a mission.
AC
WHEN the mission page loads
THEN each mission should have an edit button
AND when I click that edit button a modal should pop up
AND the modal should have a dropdown menu of enemy targets
AND I should be able to change the enemy target
AND the enemy target should update in firebase
Dev Notes
125
Step 1
Create a file in the data folder called missionEnemyData.jsimport axios and apiKeys at the top of the file
create a function called getAllEnemyTargetsgetAllEnemyTargets makes an axios.get call to /enemyId.json
.then stores response.data as a variable theEnemyTargets
it then stores these in an empty array called daEnemyTarget
an if statement passes in the daEnemyTarget
uses an Object.keys(theEnemyTargets).forEach((enemyTargetId)
set the enemyTargetId = to theEnemyTargets[enemyTarget].id
then use a .push to theEnemyTargets[enemyTarget].id intodaEnemyTargetempty array *resolvedaEnemyTarget`
Step 2
*go the printMissions function in theGalaxy and add a <select> tag with an id of enemy-target-btn to the bottom of the domString
Add missionEnemyComponent.getAllEnemyTargets beneath the <select> tag
the .then should pass in ((enemy)
on success do a forEach = sectors.ForEach((enemy)
build a domString with `'
Step 3
*go the updateMission function and add $(#enemy-target-btn).val() to get the value of the button for the enemyTarget
User Story
As a user, I should be able to edit the enemy target for a mission.
AC
WHEN the mission page loads THEN each mission should have an edit button AND when I click that edit button a modal should pop up AND the modal should have a dropdown menu of enemy targets AND I should be able to change the enemy target AND the enemy target should update in firebase
Dev Notes
125
Step 1 Create a file in the data folder called
missionEnemyData.js
importaxios
andapiKeys
at the top of the file create a function calledgetAllEnemyTargets
getAllEnemyTargets
makes an axios.get call to/enemyId.json
response.data
as a variabletheEnemyTargets
daEnemyTarget
daEnemyTarget
Object.keys(theEnemyTargets).forEach((enemyTargetId)
enemyTargetId
= totheEnemyTargets[enemyTarget].id
.push
totheEnemyTargets[enemyTarget].id into
daEnemyTargetempty array *resolve
daEnemyTarget`Step 2 *go the
printMissions
function in theGalaxy and add a<select>
tag with an id ofenemy-target-btn
to the bottom of thedomString
missionEnemyComponent.getAllEnemyTargets
beneath the<select>
tag the .then should pass in ((enemy) on success do a forEach =sectors.ForEach((enemy)
Step 3 *go the
updateMission
function and add$(
#enemy-target-btn).val()
to get the value of the button for the enemyTarget