I am trying to call the relevent data from Firebase based on the paramater in the URL.
For example:
var userId = 'EqBOy1RVZacBCaNlzbG9NDHrXl23'
//sets the variable to the exercise name in the url
var exerciseName = this.$route.params.exercise_name //'dumbbell_extension'for example
db.collection('track').doc(userId).get().then((doc) => {
if (doc.exists) {
this.exerciseData = doc.data().exerciseName //Returns 'undefined'
}
})
Here is a picture of the database: Firebase Document Image
This returns undefined
despite of the data existing in Firebase and everything else working as intended. I presume this is because it is actually searching for a field called exerciseName instead of the variable exerciseName
.