document.addEventListener('DOMContentLoaded', init);

function init(){
fetch("nav.html")
  .then(response => {
    return response.text();
  })
  .then(data => {
    document.querySelector("nav").innerHTML = data;
  })
}

const footer = document.querySelector("footer");

const fetchData = async function () {
  const fetchKategorijas = await fetch(`http://127.0.0.1:3000/categories`);
  const parseKategorijas = await fetchKategorijas.json();

  parseKategorijas.forEach((e) => {
    footer.insertAdjacentHTML(
      `beforeend`,
      `${e.category_name}`
    );
  });
};
fetchData();


        function addToCart(itemName, price) {
            alert('Added to Cart: ' + itemName + ' - €' + price.toFixed(2)); 
            
        }
    