Commit e2365a26265ca0553db56c3fde78f71b157e2846

Authored by Eric Fernandez
1 parent 5db26b0a74
Exists in master and in 1 other branch validar_pve

fix timeout

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
... ... @@ -83,7 +83,7 @@
83 83 </div>
84 84 <div class="col-12">
85 85 <button
86   - *ngIf="cantTotal > 0"
  86 + *ngIf="getCantidadProductos() > 0"
87 87 type="button"
88 88 class="btn btn-block btn-light btn-lg shadow mb-2 p-1"
89 89 routerLink="/confirmacion-carrito">
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