17 lines
430 B
JavaScript
Raw Normal View History

2024-01-18 23:29:33 +04:00
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);
}
}