This commit is contained in:
Israel Alves de Oliveira Arruda 2026-06-01 19:38:31 -03:00
parent 45f4b50233
commit 37d8baf771
1 changed files with 9 additions and 8 deletions

View File

@ -4,17 +4,18 @@ async function carregarProdutos(){
throw new Error("Não foi possível carregar a lista") throw new Error("Não foi possível carregar a lista")
} }
const produtos = await resposta.join(); const produtos = await resposta.join();
let tbody = document.querySelector("tbody");
let tbody = document.querySelector("tbody");
produtos.forEach(produto =>{ produtos.forEach(produto =>{
let linha = document.createElement("tr") let linha = document.createElement("tr")
linha.innerHTML = ` linha.innerHTML = `
<td>${produto.nome}</td> <td>${produto.nome}</td>
<td>${produto.preco}</td> <td>${produto.preco}</td>
<td>${produto.estoque}</td> <td>${produto.estoque}</td>
` `
tbody.appendChild(linha);
tbody.appendChild });
}) }
}
window.addEventListener("load", () => {
carregarProdutos();
})