Commit 54cd7e7a075dbef2222c5f20d99073035e1513a4
1 parent
7a87a1c5ae
Exists in
master
and in
1 other branch
servicios cliente
Showing
2 changed files
with
29 additions
and
0 deletions
Show diff stats
src/app/services/cliente.service.spec.ts
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +import { TestBed } from '@angular/core/testing'; | |
| 2 | + | |
| 3 | +import { ClienteService } from './cliente.service'; | |
| 4 | + | |
| 5 | +describe('ClienteService', () => { | |
| 6 | + beforeEach(() => TestBed.configureTestingModule({})); | |
| 7 | + | |
| 8 | + it('should be created', () => { | |
| 9 | + const service: ClienteService = TestBed.get(ClienteService); | |
| 10 | + expect(service).toBeTruthy(); | |
| 11 | + }); | |
| 12 | +}); |
src/app/services/cliente.service.ts
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +import { Injectable } from '@angular/core'; | |
| 2 | +import { HttpClient } from '@angular/common/http'; | |
| 3 | +import { appSettings } from "src/etc/AppSettings"; | |
| 4 | + | |
| 5 | +@Injectable({ | |
| 6 | + providedIn: 'root' | |
| 7 | +}) | |
| 8 | +export class ClienteService { | |
| 9 | + | |
| 10 | + private url = appSettings.apiClientes | |
| 11 | + | |
| 12 | + constructor(private http: HttpClient) { } | |
| 13 | + | |
| 14 | + getClienteById(id: number) { | |
| 15 | + return this.http.get(`${this.url}/get/${id}`); | |
| 16 | + } | |
| 17 | +} |