remove() function from firebase is not doing anything in addEventListener, despite correct specified location in firbase DB

28 views Asked by At

i've made a fucntion that when i click itemEl it should remove the item from fb database. but whenever i click it i get the location of the element but the remove function doesnt seem to do anything... other than that i have no error code.

I am a newbie here so i'm probably missing something

function addToShoppinglist(item) {
    let ItemEl = document.createElement("li");

    ItemEl.append(item)
    shoppingListEl.append(ItemEl)


    ItemEl.addEventListener("click", function() {
        let exactLocationItem = ref(database, `items/${item}`);
        
        console.log(exactLocationItem);
        
        
        remove(ref(database, `items/${item}`));
    });

it looks like everything is fine except that the remove function does nothing. all the console.log gets me what i (think) intend to get

0

There are 0 answers