Commit 3e236fbaabf1298d3d8e629d77fc58aadb409db2
Exists in
develop
merge conflict
Showing
3 changed files
 
Show diff stats
src/app/modules/pago-electronico/pago-electronico.component.ts
| ... | ... | @@ -4,6 +4,7 @@ import { Router } from '@angular/router'; | 
| 4 | 4 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 
| 5 | 5 | import { BsModalService } from 'ngx-bootstrap/modal'; | 
| 6 | 6 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; | 
| 7 | +import { Subscription } from 'rxjs'; | |
| 7 | 8 | |
| 8 | 9 | @Component({ | 
| 9 | 10 | selector: 'app-pago-electronico', | 
| ... | ... | @@ -12,6 +13,7 @@ import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-f | 
| 12 | 13 | }) | 
| 13 | 14 | export class PagoElectronicoComponent implements OnInit, OnDestroy { | 
| 14 | 15 | urlQr = `${APP_SETTINGS.apiImagenes}/qr/${APP_SETTINGS.deploy}/${APP_SETTINGS.codigoP}/tienda/${APP_SETTINGS.terminal}`; | 
| 16 | + subscription: Subscription; | |
| 15 | 17 | |
| 16 | 18 | constructor( | 
| 17 | 19 | private articuloService: ArticuloService, | 
| ... | ... | @@ -28,7 +30,7 @@ export class PagoElectronicoComponent implements OnInit, OnDestroy { | 
| 28 | 30 | pedidoAnombreDe: '' | 
| 29 | 31 | }; | 
| 30 | 32 | dataPago.pedidoAnombreDe = ''; | 
| 31 | - this.articuloService.pay(dataPago) | |
| 33 | + this.subscription = this.articuloService.pay(dataPago) | |
| 32 | 34 | .subscribe((res: any) => { | 
| 33 | 35 | this.articuloService.idComanda = res.data; | 
| 34 | 36 | this.router.navigate(['mensaje-final']); | 
| ... | ... | @@ -40,8 +42,9 @@ export class PagoElectronicoComponent implements OnInit, OnDestroy { | 
| 40 | 42 | }); | 
| 41 | 43 | this.mediaPantalla(); | 
| 42 | 44 | } | 
| 43 | - | |
| 45 | + | |
| 44 | 46 | ngOnDestroy() { | 
| 47 | + if (this.subscription) this.subscription.unsubscribe(); | |
| 45 | 48 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { | 
| 46 | 49 | this.modalService.hide(i); | 
| 47 | 50 | } | 
src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
| ... | ... | @@ -3,6 +3,7 @@ import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 
| 3 | 3 | import { Router } from '@angular/router'; | 
| 4 | 4 | import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; | 
| 5 | 5 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; | 
| 6 | +import { Subscription } from 'rxjs'; | |
| 6 | 7 | |
| 7 | 8 | @Component({ | 
| 8 | 9 | selector: 'app-pago-tarjeta', | 
| ... | ... | @@ -11,8 +12,9 @@ import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-f | 
| 11 | 12 | }) | 
| 12 | 13 | export class PagoTarjetaComponent implements OnInit, OnDestroy { | 
| 13 | 14 | timer: any; | 
| 14 | - @ViewChild('template', {static: true}) public template: TemplateRef<any>; | |
| 15 | + subscription: Subscription; | |
| 15 | 16 | modalRef: BsModalRef; | 
| 17 | + @ViewChild('template', { static: true }) public template: TemplateRef<any>; | |
| 16 | 18 | |
| 17 | 19 | constructor( | 
| 18 | 20 | private articuloService: ArticuloService, | 
| ... | ... | @@ -29,7 +31,7 @@ export class PagoTarjetaComponent implements OnInit, OnDestroy { | 
| 29 | 31 | const dataPago = { | 
| 30 | 32 | pedidoAnombreDe: '' | 
| 31 | 33 | }; | 
| 32 | - this.articuloService.pay(dataPago) | |
| 34 | + this.subscription = this.articuloService.pay(dataPago) | |
| 33 | 35 | .subscribe((res: any) => { | 
| 34 | 36 | this.modalRef.hide(); | 
| 35 | 37 | this.articuloService.idComanda = res.data; | 
| ... | ... | @@ -45,6 +47,7 @@ export class PagoTarjetaComponent implements OnInit, OnDestroy { | 
| 45 | 47 | } | 
| 46 | 48 | |
| 47 | 49 | ngOnDestroy() { | 
| 50 | + if (this.subscription) this.subscription.unsubscribe(); | |
| 48 | 51 | if (this.timer) clearTimeout(this.timer); | 
| 49 | 52 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { | 
| 50 | 53 | this.modalService.hide(i); | 
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -85,9 +85,9 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 85 | 85 | ignoreBackdropClick: true, | 
| 86 | 86 | class: 'modal-dialog-centered' | 
| 87 | 87 | }); | 
| 88 | - this.modalRef.content.onClose.subscribe((res) => { | |
| 88 | + this.modalRef.content.onClose.subscribe((resClose) => { | |
| 89 | 89 | this.modalRef = null; | 
| 90 | - if (!res) return; | |
| 90 | + if (!resClose) return; | |
| 91 | 91 | this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt) | 
| 92 | 92 | .subscribe((res: ISinonimo[]) => { | 
| 93 | 93 | if (res.length) { |