From e612a8203033471d831e545c1cb7f3e7a39371b5 Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Thu, 12 Sep 2019 10:46:39 -0300 Subject: [PATCH] unsubscribe on back --- .../confirmacion-carrito/confirmacion-carrito.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts index 555dc7e..e5041d6 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts @@ -4,6 +4,7 @@ import { Location } from '@angular/common'; import { ProductoService } from 'src/app/services/producto.service'; import { Producto } from 'src/app/wrappers/producto'; import { Router } from '@angular/router'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-confirmacion-carrito', @@ -19,6 +20,7 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { private compraConEfectivofinalizada: boolean = false; private compraConQRfinalizada: boolean = false; private verQR: boolean = false; + private subscribePago: Subscription; constructor( private location: Location, @@ -42,10 +44,13 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { volverPreviousPage() { + this.subscribePago.unsubscribe(); + if (this.verQR) { this.verQR = !this.verQR; return; } + this.location.back(); } @@ -76,7 +81,7 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { this.verQR = true; } - this.productoService.pagar(medioPago) + this.subscribePago = this.productoService.pagar(medioPago) .subscribe(() => { clearTimeout(this.timerReposo); -- 1.9.1