Hi, i try to change the value of a variable in a firebase data base.
But my code don’t work
this.afAuth.authState.subscribe(data => { // ajoute des tacoPoint
var ar = 0;
let ab;
const a = this.afDatabase.object(`TacoPoint/${data.uid}`)
this.test = a.valueChanges();
this.test.forEach(e =>{
e.Tacopoint = e.Tacopoint + 20
console.log(e)
ar = e.Tacopoint;
})
a.set({Tacopoint : ar})
console.log(ar) // 0 in console
})
The forEach loop is excute after the set() functions so i don’t know how to change that.
(sorry for bad Enlgish)
Thanks