Commit 3552d0e45226d3ee491d75cf0b2d968cba1d4bbf

Authored by Marcelo Puebla
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !113
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
... ... @@ -4,6 +4,7 @@ import { Location } from '@angular/common';
4 4 import { ProductoService } from 'src/app/services/producto.service';
5 5 import { Producto } from 'src/app/wrappers/producto';
6 6 import { Router } from '@angular/router';
  7 +import { Subscription } from 'rxjs';
7 8  
8 9 @Component({
9 10 selector: 'app-confirmacion-carrito',
... ... @@ -19,6 +20,7 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy {
19 20 private compraConEfectivofinalizada: boolean = false;
20 21 private compraConQRfinalizada: boolean = false;
21 22 private verQR: boolean = false;
  23 + private subscribePago: Subscription;
22 24  
23 25 constructor(
24 26 private location: Location,
... ... @@ -37,15 +39,19 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy {
37 39  
38 40 ngOnDestroy() {
39 41  
  42 + this.subscribePago.unsubscribe();
40 43 clearTimeout(this.timerReposo);
41 44 }
42 45  
43 46 volverPreviousPage() {
44 47  
  48 + this.subscribePago.unsubscribe();
  49 +
45 50 if (this.verQR) {
46 51 this.verQR = !this.verQR;
47 52 return;
48 53 }
  54 +
49 55 this.location.back();
50 56 }
51 57  
... ... @@ -76,7 +82,7 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy {
76 82 this.verQR = true;
77 83 }
78 84  
79   - this.productoService.pagar(medioPago)
  85 + this.subscribePago = this.productoService.pagar(medioPago)
80 86 .subscribe(() => {
81 87  
82 88 clearTimeout(this.timerReposo);