From 7a87a1c5ae475646452685eff2d650b4d116cd66 Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Tue, 17 Sep 2019 16:48:09 -0300 Subject: [PATCH] =?UTF-8?q?env=C3=ADo=20datos=20del=20cliente=20a=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/services/producto.service.ts | 19 ++++++++++++++++--- src/etc/AppSettings ejemplo.ts | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/app/services/producto.service.ts b/src/app/services/producto.service.ts index c825683..237feb6 100644 --- a/src/app/services/producto.service.ts +++ b/src/app/services/producto.service.ts @@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { appSettings } from 'src/etc/AppSettings'; import { Producto } from '../wrappers/producto'; +import { ClienteService } from './cliente.service'; @Injectable({ providedIn: 'root' @@ -15,7 +16,7 @@ export class ProductoService { mostrar: string; esPromoPersonalizada: boolean = false; - constructor(private http: HttpClient) { } + constructor(private http: HttpClient, private clienteService: ClienteService) { } getProductoById(id): Observable { @@ -80,8 +81,20 @@ export class ProductoService { } pagar(medioPago: string) { - return this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { - productos: this.productos + + return new Observable((observer) => { + + this.clienteService.getClienteById(-1).subscribe(cliente => { + + this.http.post(`${appSettings.apiUrl}/comprobante/guardar/${medioPago}`, { + productos: this.productos, + cliente: cliente + }).subscribe((data) => { + + observer.next(data); + observer.complete(); + }); + }); }); } diff --git a/src/etc/AppSettings ejemplo.ts b/src/etc/AppSettings ejemplo.ts index 9edd44b..ea89eb1 100644 --- a/src/etc/AppSettings ejemplo.ts +++ b/src/etc/AppSettings ejemplo.ts @@ -1,4 +1,5 @@ export const appSettings = { // apiUrl: 'http://10.231.45.117:4705/autoservicio', - // apiImagenes: 'http://10.231.45.117:4513/' + // apiImagenes: 'http://10.231.45.117:4513/', + // apiClientes: 'http://localhost:1515/clientes' }; -- 1.9.1