pago-tarjeta.component.ts
857 Bytes
import { Component, OnInit } from '@angular/core';
import { ArticuloService } from 'src/app/services/articulo/articulo.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-pago-tarjeta',
templateUrl: './pago-tarjeta.component.html',
styleUrls: ['./pago-tarjeta.component.scss']
})
export class PagoTarjetaComponent implements OnInit {
constructor(
private articuloService: ArticuloService,
private router: Router,
) { }
ngOnInit() {
if (!this.articuloService.carrito.length) {
this.router.navigate(['']);
return;
}
const dataPago = {
pedidoAnombreDe: ''
};
this.articuloService.pay(dataPago)
.subscribe((res: any) => {
this.articuloService.idComanda = res.data;
this.router.navigate(['mensaje-final']);
}, err => console.error(err));
}
}