Commit e2365a26265ca0553db56c3fde78f71b157e2846
1 parent
5db26b0a74
Exists in
master
and in
1 other branch
fix timeout
Showing
3 changed files
with
10 additions
and
11 deletions
Show diff stats
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -64,11 +64,11 @@ export class InicioComponent implements OnInit { |
| 64 | 64 | |
| 65 | 65 | if (res.length === 0) { |
| 66 | 66 | //Si no tiene promociones la cargará al carrito despues de un tiempo |
| 67 | - setTimeout(() => { | |
| 67 | + // setTimeout(() => { | |
| 68 | 68 | this.productoAcargar.cantidad = 1; |
| 69 | 69 | this.productoService.productos.push(this.productoAcargar); |
| 70 | 70 | this.productoAcargar = this.productoService.productoAcargar = undefined; |
| 71 | - }, 2000) | |
| 71 | + // }, 2000) | |
| 72 | 72 | } else { |
| 73 | 73 | |
| 74 | 74 | this.promociones = res; |
src/app/components/sidebar/sidebar.component.html
src/app/components/sidebar/sidebar.component.ts
| ... | ... | @@ -34,14 +34,13 @@ export class SidebarComponent implements OnInit { |
| 34 | 34 | |
| 35 | 35 | getCantidadProductos() { |
| 36 | 36 | |
| 37 | - setTimeout(() => { | |
| 38 | - var cantTotalAux = 0; | |
| 39 | - this.productosCarrito.forEach(producto => { | |
| 40 | - | |
| 41 | - cantTotalAux += producto.cantidad; | |
| 42 | - }, 250); | |
| 43 | - this.cantTotal = cantTotalAux; | |
| 44 | - }) | |
| 37 | + var cantTotalAux = 0; | |
| 38 | + this.productosCarrito.forEach(producto => { | |
| 39 | + | |
| 40 | + cantTotalAux += producto.cantidad; | |
| 41 | + }); | |
| 42 | + this.cantTotal = cantTotalAux; | |
| 43 | + | |
| 45 | 44 | return this.cantTotal; |
| 46 | 45 | } |
| 47 | 46 |