[Vuejs]-How to access data from within a key

0👍

This is my best guess as to what is going on with your data structure. I hope this helps and please comment to clarify anything else.

onCreateApplication(){
  fb.eventsCollection.orderBy('startDate', 'desc').onSnapshot(querySnapshot => {
    querySnapshot.forEach(doc => {
      let data = doc.data();    
      let applications = Object.keys(data.applicants).map(function(id){
        let application = {
          event: {
            id: data.id,
            title: data.title,
            slug: data.slug
          },
          user: {
            id: id
          },
          status: data.applicants[id].status,
          appliedDate: data.applicants[id].created
        })

        fb.applicationsCollection.add(application);

        return application;
      })
    })
  })
}

Leave a comment