Mudando
This commit is contained in:
parent
45f4b50233
commit
37d8baf771
|
|
@ -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();
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue