Commit 127658762dbaf48db143b7a7e628d8f42549bf52

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(mpuebla)

See merge request !49
src/app/components/inicio/inicio.component.ts
... ... @@ -123,11 +123,17 @@ export class InicioComponent implements OnInit {
123 123  
124 124 promoSeleccionada($event: Producto) {
125 125  
126   - this.promoAcargar = $event;
127   - if (this.promoAcargar.tieneSinonimos) {
128   - var sector = this.promoAcargar.CodSec;
129   - var codigo = this.promoAcargar.CodArt;
130   - this.getSinonimos(sector, codigo);
  126 + if ($event.tieneSinonimos) {
  127 +
  128 + this.productoService.getProductoById($event.id)
  129 + .subscribe((res : Producto) => {
  130 +
  131 + $event.imagenes = res.imagenes;
  132 + this.promoAcargar = $event;
  133 + this.getSinonimos(this.promoAcargar.CodSec, this.promoAcargar.CodArt);
  134 + },
  135 + error => { console.log(error); })
  136 +
131 137  
132 138 } else if (this.popoverDirective) {
133 139 this.popoverDirective.hide();
src/app/services/producto.service.ts
... ... @@ -16,6 +16,11 @@ export class ProductoService {
16 16  
17 17 constructor(private http: HttpClient) { }
18 18  
  19 + getProductoById(id): Observable<any> {
  20 +
  21 + return this.http.get(`${appSettings.apiUrl}/articulos/${id}`);
  22 + }
  23 +
19 24 getAll(): Observable<any> {
20 25  
21 26 return this.http.get(`${appSettings.apiUrl}/articulos`);