Commit cd06fe207d4117d026973db115c3a868f2361317
1 parent
910235af7e
Exists in
master
and in
1 other branch
Creado service de comanda.
Showing
2 changed files
with
36 additions
and
0 deletions
Show diff stats
src/app/services/comanda.service.spec.ts
... | ... | @@ -0,0 +1,12 @@ |
1 | +import { TestBed } from '@angular/core/testing'; | |
2 | + | |
3 | +import { ComandaService } from './comanda.service'; | |
4 | + | |
5 | +describe('ComandaService', () => { | |
6 | + beforeEach(() => TestBed.configureTestingModule({})); | |
7 | + | |
8 | + it('should be created', () => { | |
9 | + const service: ComandaService = TestBed.get(ComandaService); | |
10 | + expect(service).toBeTruthy(); | |
11 | + }); | |
12 | +}); |
src/app/services/comanda.service.ts
... | ... | @@ -0,0 +1,24 @@ |
1 | +import { Injectable } from "@angular/core"; | |
2 | +import { HttpClient } from "@angular/common/http"; | |
3 | +import { appSettings } from "src/etc/AppSettings"; | |
4 | +import { Observable } from "rxjs"; | |
5 | +import { Comanda } from '../wrappers/comanda'; | |
6 | + | |
7 | +@Injectable({ | |
8 | + providedIn: "root" | |
9 | +}) | |
10 | +export class ComandaService { | |
11 | + private apiUrl: string = appSettings.apiUrl; | |
12 | + | |
13 | + constructor(private http: HttpClient) { } | |
14 | + | |
15 | + getAll(): Observable<any> { | |
16 | + | |
17 | + return this.http.get(`${this.apiUrl}/comandas`); | |
18 | + } | |
19 | + | |
20 | + updateComanda(id: number, estado: number, observacion: string): Observable<any> { | |
21 | + | |
22 | + return this.http.get(`${this.apiUrl}/comandas/update/${id}/${estado}/${observacion}`); | |
23 | + } | |
24 | +} |