Skip to content

Commit 72862fb

Browse files
Fix route when deleting product
1 parent 2ab10df commit 72862fb

5 files changed

Lines changed: 38 additions & 10 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ O Desafio começou em 14 de março de 2022.
8181
- **Semana 3:** Validações dos formulários (login, contato e cadastro de produtos), criação de rotas e controllers e implementação do banco de dados.
8282
- **Semana 4:** Finalização do projeto com cadastro dos itens no banco de dados e funcionalidade de adicionar mais produtos e/ou editar produtos existentes.
8383

84+
## 🛡️ Badges recebidas pelo projeto
85+
86+
<table style="text-align: center;">
87+
<tr>
88+
<td>
89+
<img height="150px" src="https://raw.githubusercontent.com/sucodelarangela/alura-geek/master/public/images/Badge_Alura_Challenge_FRONT-END_First_v2.png">
90+
</td>
91+
<td>
92+
<img height="150px" src="https://raw.githubusercontent.com/sucodelarangela/alura-geek/master/public/images/Badge_Alura_Challenge_FRONT-END_Helper.png">
93+
</td>
94+
</tr>
95+
<tr>
96+
<td>Badge de Participação</td>
97+
<td>Badge de Apoio<br>à Comunidade</td>
98+
</tr>
99+
</table>
100+
84101
---
85102

86103
<div id="English" style="font-style: italic;">
@@ -148,6 +165,23 @@ The Challenge started at March 14th, 2022.
148165
- **Week 3:** Form validations (login, contact and product registration), creation of routes and controllers and implementation of database.
149166
- **Week 4:** Project conclusion (products registered in database and new product registration/edition functionality).
150167

168+
## 🛡️ Badges received in this project
169+
170+
<table style="text-align: center;">
171+
<tr>
172+
<td>
173+
<img height="150px" src="https://raw.githubusercontent.com/sucodelarangela/alura-geek/master/public/images/Badge_Alura_Challenge_FRONT-END_First_v2.png">
174+
</td>
175+
<td>
176+
<img height="150px" src="https://raw.githubusercontent.com/sucodelarangela/alura-geek/master/public/images/Badge_Alura_Challenge_FRONT-END_Helper.png">
177+
</td>
178+
</tr>
179+
<tr>
180+
<td>Participation Badge</td>
181+
<td>Community<br>Support Badge</td>
182+
</tr>
183+
</table>
184+
151185
---
152186

153187
Developed with 🧡 by [@sucodelarangela 🍊](https://angelacaldas.vercel.app) (it's a me!)

public/images/og-image.png

23.2 KB
Loading

src/controllers/ProductController.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ module.exports = {
1717
} else if (pass.password !== password) {
1818
res.redirect('/pass-incorrect')
1919
} else {
20-
if (action == 'delete') {
21-
db.run(`DELETE FROM products WHERE id = ${itemCode}`)
22-
} else if (action == 'edit') {
23-
console.log('edited')
24-
// res.redirect(`/room/${roomId}`)
25-
}
20+
db.run(`DELETE FROM products WHERE id = ${itemCode}`)
21+
res.redirect('/todos-os-produtos')
2622
}
2723
})
2824
},

src/db/alurageek.sqlite

100 KB
Binary file not shown.

views/parts/edit.ejs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
hidden
1818
aria-hidden="true"
1919
/>
20-
<div class="drag__area">
21-
<p class="drag__area--text">
22-
Arraste para adicionar uma imagem para o produto
23-
</p>
20+
<div class="drag__area active" style="padding: 0;">
21+
<img src="<%= item.image %>" alt="<%= item.altText %>">
2422
</div>
2523
<span>ou</span>
2624
<label for="product__image" class="product__image--label"></label>

0 commit comments

Comments
 (0)