Commit a19a44aa9fa7150a836473e3bf13fe2f79b7a379
1 parent
69c4cb8cef
Exists in
master
Cambio en ruta para traer promociones.
Showing
1 changed file
with
2 additions
and
2 deletions
 
Show diff stats
src/app/services/producto.service.ts
| 1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; | 
| 2 | import { HttpClient } from '@angular/common/http'; | 2 | import { HttpClient } from '@angular/common/http'; | 
| 3 | import { Observable } from 'rxjs'; | 3 | import { Observable } from 'rxjs'; | 
| 4 | import { appSettings } from 'src/etc/AppSettings'; | 4 | import { appSettings } from 'src/etc/AppSettings'; | 
| 5 | import { Producto } from '../wrappers/producto'; | 5 | import { Producto } from '../wrappers/producto'; | 
| 6 | 6 | ||
| 7 | @Injectable({ | 7 | @Injectable({ | 
| 8 | providedIn: 'root' | 8 | providedIn: 'root' | 
| 9 | }) | 9 | }) | 
| 10 | export class ProductoService { | 10 | export class ProductoService { | 
| 11 | 11 | ||
| 12 | productos: Producto[] = []; | 12 | productos: Producto[] = []; | 
| 13 | productoAcargar: Producto; | 13 | productoAcargar: Producto; | 
| 14 | 14 | ||
| 15 | constructor(private http: HttpClient) { } | 15 | constructor(private http: HttpClient) { } | 
| 16 | 16 | ||
| 17 | getAll(): Observable<any> { | 17 | getAll(): Observable<any> { | 
| 18 | 18 | ||
| 19 | return this.http.get(`${appSettings.apiUrl}/articulos`); | 19 | return this.http.get(`${appSettings.apiUrl}/articulos`); | 
| 20 | } | 20 | } | 
| 21 | 21 | ||
| 22 | setProductos(producto: Producto) { | 22 | setProductos(producto: Producto) { | 
| 23 | 23 | ||
| 24 | this.productos.push(producto); | 24 | this.productos.push(producto); | 
| 25 | } | 25 | } | 
| 26 | 26 | ||
| 27 | getPromocion(sector, codigo): Observable<any> { | 27 | getPromocion(sector, codigo): Observable<any> { | 
| 28 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 28 | |
| 29 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${3}/${25}`; | 29 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 
| 30 | return this.http.get(url); | 30 | return this.http.get(url); | 
| 31 | } | 31 | } | 
| 32 | 32 | ||
| 33 | } | 33 | } | 
| 34 | 34 |