Commit e612a8203033471d831e545c1cb7f3e7a39371b5
1 parent
d1da6b40b7
Exists in
master
unsubscribe on back
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
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, |
... | ... | @@ -42,10 +44,13 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
42 | 44 | |
43 | 45 | volverPreviousPage() { |
44 | 46 | |
47 | + this.subscribePago.unsubscribe(); | |
48 | + | |
45 | 49 | if (this.verQR) { |
46 | 50 | this.verQR = !this.verQR; |
47 | 51 | return; |
48 | 52 | } |
53 | + | |
49 | 54 | this.location.back(); |
50 | 55 | } |
51 | 56 | |
... | ... | @@ -76,7 +81,7 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
76 | 81 | this.verQR = true; |
77 | 82 | } |
78 | 83 | |
79 | - this.productoService.pagar(medioPago) | |
84 | + this.subscribePago = this.productoService.pagar(medioPago) | |
80 | 85 | .subscribe(() => { |
81 | 86 | |
82 | 87 | clearTimeout(this.timerReposo); |