I need to update the name of a Key in Firebase and then update a child of the same name.
I'm trying to do this:
AsyncUpdateMap(){
this._userID = "Aliansce";
this._mapID = Marker.MarkerId;
this.locationROOT = this.FirebaseInstance.ref('users/' + this._userID).child('/LOCATIONS/' + this._mapID);
this.locationROOT.once('value').then((e) => {
this.locationROOT.update({
mapUid: this._mapID,
}) .then((sucess) => { // Then do Set Location Root
console.log("LOCATION ROOT ATUALIZADO COM SUCESSO");
const SYSTEM_DATE_CLASS = new SystemDate();
this.mapROOT = this.FirebaseInstance.ref('users/' + this._userID).child('/MAPS/' + this._mapID);
this.mapROOT.update({
mapUid: this._mapID,
mapDates: {
dateEdit: SYSTEM_DATE_CLASS.DateIso
}
}) .then((sucess) => { // Then do Set Map Root
console.log("MAP ROOT ATUALIZADO COM SUCESSO")
}) .catch((error) => { // Catch do Set Map Root
console.warn("ERROR: " + error);
});
}) .catch((error) => { // Catch do Set Location Root
console.warn("ERROR: " + error);
});
}) .catch((error) => { // Catch do Location Root
console.warn("ERROR: " + error);
});
}