Firebase query

0

How could I access the sub index of the object I show in the image. I'm trying it with Object.values (sale [key]) , it works but I can not add more attributes. Any help?

This is the code: Claro

firebase.database().ref('venta/' + this.state.user.uid).on('value', e => {
        const ventas = []
        const venta = e.val()
          for (let key in venta) {
            console.log(venta[key])
            ventas.push({
              id: key,
              venta: Object.values(venta[key])
            })
            commit('setVentaBeta', ventas)
          }
        })

The data reaches me:

idVenta: {
          idproducto1: {
            cantidad: '',
            precio: ''
          },
          idproducto2: {
            cantidad: '',
            precio: ''
          }
        }

I would like to be able to add a new attribute when pushing the array

    
asked by Jorge Arturo Huima Ruiz 24.10.2018 в 17:40
source

0 answers