diff --git a/src/app/services/comanda.service.spec.ts b/src/app/services/comanda.service.spec.ts new file mode 100644 index 0000000..e1230b3 --- /dev/null +++ b/src/app/services/comanda.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ComandaService } from './comanda.service'; + +describe('ComandaService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ComandaService = TestBed.get(ComandaService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/comanda.service.ts b/src/app/services/comanda.service.ts new file mode 100644 index 0000000..f26f780 --- /dev/null +++ b/src/app/services/comanda.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from "@angular/core"; +import { HttpClient } from "@angular/common/http"; +import { appSettings } from "src/etc/AppSettings"; +import { Observable } from "rxjs"; +import { Comanda } from '../wrappers/comanda'; + +@Injectable({ + providedIn: "root" +}) +export class ComandaService { + private apiUrl: string = appSettings.apiUrl; + + constructor(private http: HttpClient) { } + + getAll(): Observable { + + return this.http.get(`${this.apiUrl}/comandas`); + } + + updateComanda(id: number, estado: number, observacion: string): Observable { + + return this.http.get(`${this.apiUrl}/comandas/update/${id}/${estado}/${observacion}`); + } +}