Я пытаюсь использовать транзакцию Firebase в JavaScript.По какой-то причине он полностью перестал работать и обновляться.Это сработало несколько часов назад, но, возможно, я случайно изменил код, чтобы он не работал.Есть идеи, почему транзакция не обновляется?
function paymentSubmit() {
var user = firebase.auth().currentUser;
var email = user.email;
var parking_location = document.getElementById('parking_location_input').value;
var price = document.getElementById('price_input').value;
firebaseRef.child("Parking Lots").child(parking_location).transaction(function (lot) {
if (lot) {
console.log(lot);
if (lot.admin == email) {
lot.price = price;
}
}
return lot;
},
function (error, committed, snapshot) {
if (error) {
console.log('Transaction failed abnormally!', error);
} else if (!committed) {
console.log('We aborted the transaction.');
} else {
console.log('Lot updated!');
}
}).then(function (snapshot) {
console.log('Transaction successfully committed!');
firebaseRef.child("Parking Lots").child(parking_location).set({
"price": snapshot.price,
"admin": snapshot.admin
});
}).catch(function (error) {
console.log('Transaction failed: ', error);
});
clearForm();
}
![Database](https://i.stack.imgur.com/uGHaY.png?s=256)