Skip to content

Commit

Permalink
melhorando criacao de produto
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaudiOmatheuuss committed Sep 24, 2023
1 parent 84c68f3 commit e7b64b0
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/js/services/produtos-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
72 changes: 72 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
1 change: 1 addition & 0 deletions views/adm.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ <h1>Todos os produtos</h1>
<p>2023</p>
</div>
</body>
<script type="module" src="../assets/js/controllers/cria-produtos-controllers.js"></script>
<script type="module" src="../assets/js/controllers/exibeCard-controllers.js"></script>
<script src="../assets/js/criaRodape.js"></script>
</html>
2 changes: 1 addition & 1 deletion views/criarProduto.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h2 class="form__criaProduto__title">Adicionar novo produto</h2>
</div>
</div>

<button class="form__criaProduto__btn" type="submit" data-btnEnviar>Adicionar Produto</button>
<button class="form__criaProduto__btn" type="submit">Adicionar Produto</button>

</form>
</div>
Expand Down

0 comments on commit e7b64b0

Please sign in to comment.