import {
getAllLines
} from "./lines-rest-api";
async function createCard(product, color, price, image) {
const cardContainer = document.querySelector('.row.gx-5');
if (image == "") {
image = "images/iphone_14_pro.png"
}
const cardItem =
`
${product}, ${color}
${price} ₽
`;
cardContainer.insertAdjacentHTML('beforeend', cardItem);
}
async function createCards() {
const data = await getAllLines();
console.log(data)
data.forEach(item => {
createCard(item.product, item.colors.name, item.price, item.image);
});
}
document.addEventListener('DOMContentLoaded', () => {
createCards();
});