0
I’m trying to push into an Array, but it’s giving this error: "Typeerror: Devices.push is not a Function"
let device = this.$store.getters['bluetooth/Device'].UUID
let devices = firebase.getValue('/connected_devices')
let found = false
if(devices == null)
devices = []
for(let i = 0; i < devices; i++){
if(device.mac == devices[i].mac){
device = devices[i]
found = true
}
}
if(!found)
this.devices[i].push(device)
device.pi = 1234
device.teste = 4321
firebase.setValue('/connected_devices', devices)
What does your Vices return ? it is falling into == null condition?
– Leonardo Buta
Here
this.devices
you reference the Vue instance. If you want to use the method variable remove thethis
– Marconi