Skip to content

Commit

Permalink
Refatorando
Browse files Browse the repository at this point in the history
  • Loading branch information
andreeluis committed Nov 24, 2023
1 parent 47315ff commit 96ca18e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/gerenciar-estoque/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<section class="componet-list">
<h2>Estoque de Peças</h2>

<button id="add-component">+ Componete</button>
<button id="add-component">Novo Componente</button>

<ul id="component-list"></ul>
</section>
Expand Down
12 changes: 4 additions & 8 deletions src/gerenciar-estoque/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ async function showComponents() {

const textoHTML = componentsList.map(component => `
<li>
<span class="qtd">${String(component.qtd).padStart(2, '0')}</span>
${component.name}
<button value="${component.id}" class="edit"><i class="fas fa-edit"></i></button>
<button value="${component.id}" class="delete"><i class="fas fa-trash-alt"></i></button>
<span class="qtd">${String(component.qtd).padStart(2, '0')}</span>
${component.name}
<button value="${component.id}" class="edit"><i class="fas fa-edit"></i></button>
<button value="${component.id}" class="delete"><i class="fas fa-trash-alt"></i></button>
</li>
`).join('');

Expand Down Expand Up @@ -113,12 +113,8 @@ async function handleEditSubmit(event) {
};

try {
console.log(componentsList);

componentsList = componentsList.map(component => component.id == id ? updatedComponent : component);

console.log(componentsList);

const response = await fetch(`${apiURL}/users/${userId}`, {
method: 'PATCH',
headers: {
Expand Down

0 comments on commit 96ca18e

Please sign in to comment.