[Vuejs]-How to return the Id of the database and not a Default Id in VUE?

0👍

You should be getting response from the result in your code:

Object.keys(result.data).forEach((key) => {
      let appData = snapshot.data[key]

Not sure if you’re receiving an object in the response.data there, or an array. If it’s actually an array you can use array mapping like this:

.then((result) => {
    console.log(JSON.parse(result))
    const events = []

    this.events = response.data.map(r => {
        return {
            id: r.id  // or maybe r.key in your case
            // rest of the properties you want to map
        }
    })
})

Just make sure to map your properties correctly, I assumed that you have a property ID, it could be a KEY in your case.

Leave a comment