From e7b64b0539d5a19c9479937d93c2b23443426750 Mon Sep 17 00:00:00 2001 From: Claud10matheus Date: Sat, 23 Sep 2023 23:04:22 -0300 Subject: [PATCH] melhorando criacao de produto --- assets/js/services/produtos-services.js | 1 + db.json | 72 +++++++++++++++++++++++++ views/adm.html | 1 + views/criarProduto.html | 2 +- 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/assets/js/services/produtos-services.js b/assets/js/services/produtos-services.js index 52493a4..8cbe675 100644 --- a/assets/js/services/produtos-services.js +++ b/assets/js/services/produtos-services.js @@ -25,6 +25,7 @@ async function criaProdutos (imageUrl, section, name, price, description) { }) }).then(resposta => { if (resposta.ok) { //se resposta tiver correta retorna o body + window.location.href = "../../../views/adm.html" return resposta.body } else { throw new Error("Não foi possível criar o produto.") diff --git a/db.json b/db.json index 51f4687..9dc1b1f 100644 --- a/db.json +++ b/db.json @@ -161,6 +161,78 @@ "section": "diversos", "description": "Voluptas voluptatum quibusdam similique, class debitis alias maecenas eveniet ridiculus, facilis fusce! Ullam conubia? Sociis, minima malesuada habitasse distinctio sequi aliqua malesuada. Quisque deleniti proin expedita, aliquid litora. Iste recusandae? Commodo, quia ridiculus doloribus vero dictum? Penatibus donec placeat faucibus, dolorum do. Animi porta anim magnam", "id": 18 + }, + { + "imageUrl": "products__container", + "section": "consoles", + "name": "asdwa", + "price": "22,00", + "description": "sadw", + "id": 19 + }, + { + "imageUrl": "sdawd", + "section": "starWars", + "name": "daswdaw", + "price": "22,00", + "description": "sadw", + "id": 20 + }, + { + "imageUrl": "dawdsa", + "section": "starWars", + "name": "dawdsa", + "price": "22,00", + "description": "sdadwa", + "id": 21 + }, + { + "imageUrl": "asdaw", + "section": "starWars", + "name": "dawdas", + "price": "22,00", + "description": "adawsdw", + "id": 22 + }, + { + "imageUrl": "asdaw", + "section": "starWars", + "name": "aaaaaaaaa", + "price": "33,00", + "description": "dsad", + "id": 23 + }, + { + "imageUrl": "dasdaw", + "section": "starWars", + "name": "asdaw", + "price": "22,00", + "description": "sadw", + "id": 24 + }, + { + "imageUrl": "sad", + "section": "diversos", + "name": "aaaaaaaaaaaaaa", + "price": "22,00", + "description": "sadaw", + "id": 25 + }, + { + "imageUrl": "asdwa", + "section": "consoles", + "name": "aaaaaaaaaaaa", + "price": "22,00", + "description": "asdwa", + "id": 26 + }, + { + "imageUrl": "dasdw", + "section": "starWars", + "name": "asdaw", + "price": "22,00", + "description": "dasdaw", + "id": 27 } ] } \ No newline at end of file diff --git a/views/adm.html b/views/adm.html index 950e6de..f22d85f 100644 --- a/views/adm.html +++ b/views/adm.html @@ -83,6 +83,7 @@

Todos os produtos

2023

+ \ No newline at end of file diff --git a/views/criarProduto.html b/views/criarProduto.html index 3c00a86..621057d 100644 --- a/views/criarProduto.html +++ b/views/criarProduto.html @@ -117,7 +117,7 @@

Adicionar novo produto

- +