Open christopherjohnson1 opened 4 years ago
As a user, I should be able to see all my missions.
WHEN I am logged in AND on the missions dashboard THEN I should see all missions
missionsData.js
src/javascripts/helpers/data
axios
apiKeys file
baseUrl
getMissions
allMissions
response.data
missions
Object.keys
.forEach()
missionsId
allMissions[missionsId].id = missionsId
.push()
missions.js
utils
buildAllMissions
domString
<h2>
utils.printToDom()
missionCards
buildAllMissionCards
authData
checkLoginStatus
USER STORY
As a user, I should be able to see all my missions.
AC
WHEN I am logged in AND on the missions dashboard THEN I should see all missions
DEV NOTES
missionsData.js
file insrc/javascripts/helpers/data
axios
apiKeys file
baseUrl
variable and give it a value of the database url in the apiKeys filegetMissions
that makes a new Promise (takes two parameter of resolve and reject) and calls axios.get()allMissions
and give it a value ofresponse.data
missions
Object.keys
and pass inallMissions
as an argument.forEach()
to loop throughallMissions
missionsId
as the argument for the.forEach()
allMissions[missionsId].id = missionsId
.push()
into the missions arraymissions.js
missionsData.js
utils
buildAllMissions
getMissions
missions
domString
variable with an<h2>
element that says Missions.forEach()
loop to go through the missions array, pass in missions as an argument.forEach()
close any elements and then useutils.printToDom()
missionCards
buildAllMissionCards
domString
variable and build a card using template literals to populate the needed informationmissionCards
tomissions.js
.forEach()
loop importmissions.js
toauthData
callbuildAllMissions
incheckLoginStatus
in the else of the if.. else