I am making a table that shows me data from some sensors, this table shows the data from a database hosted in firebase. As data is entered, the table will display. I'm having trouble deleting the data because for each item that is inserted, I've put an id in it so I can identify it as follows:
Each of the elements in the table has its own button to delete, whose id is the same as the database element:

To delete the data, what I'm doing is that clicking the button takes the value of the button id, adding it to the URL of the database path, sending a DELETE request:
async function reply_click(clicked_id){
var bid = clicked_id;
var firebase = "https://iotplatform-11dca-default-rtdb.firebaseio.com/users/awsBewgkSMcqiINzOoFUiUe9D6r1/data_widget/sensor/humedad/temperatura/";
var json = ".json";
var url = firebase+bid+json;
console.log(url);
const request = new Request(url, { method: 'DELETE'})
const response = await fetch(request)
return await response.json()
}
I printed the url obtained to check that it is correct but the data is not deleted. After an undefined time or without knowing that I have moved it, the data is automatically deleted leaving everything in null.
I hope you have explained me well and you can help me
This snippet will remove the child follow the documentation carefully
https://firebase.google.com/docs/database/web/read-and-write
initRef = firebase.database().ref('users/awsBewgkSMcqiINzOoFUiUe9D6r1/data_widget/sensor/humedad/temperatura/');
function deleteIssue(id) {
initRef.child(`${id}`).remove();
console.log('child removed oncliking button '+ id );
}