From 37d8baf77142b1d1b6f476952576bdddb0558fa6 Mon Sep 17 00:00:00 2001 From: Israel Date: Mon, 1 Jun 2026 19:38:31 -0300 Subject: [PATCH] Mudando --- apirest/frontend/script.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apirest/frontend/script.js b/apirest/frontend/script.js index 92377bb..9e1ebfc 100644 --- a/apirest/frontend/script.js +++ b/apirest/frontend/script.js @@ -4,17 +4,18 @@ async function carregarProdutos(){ throw new Error("Não foi possível carregar a lista") } const produtos = await resposta.join(); - - let tbody = document.querySelector("tbody"); - + let tbody = document.querySelector("tbody"); produtos.forEach(produto =>{ let linha = document.createElement("tr") linha.innerHTML = ` ${produto.nome} ${produto.preco} ${produto.estoque} - ` - - tbody.appendChild - }) -} \ No newline at end of file + ` + tbody.appendChild(linha); + }); +} + +window.addEventListener("load", () => { + carregarProdutos(); +}) \ No newline at end of file