Int_Prog/лаб3/lab3/public/scripts/menu.js
2024-01-19 01:24:45 +04:00

17 lines
430 B
JavaScript

import { fetchAllProducts } from "./api/fetchAllProducts.js";
import { getMenuItemHTML } from "./helpers/getMenuItemHTML.js";
import { menuList } from "./variables.js";
if (menuList) drawAllProducts();
async function drawAllProducts() {
try {
const data = await fetchAllProducts();
for (const product of data) {
menuList.innerHTML += getMenuItemHTML(product);
}
} catch (err) {
console.log(err);
}
}