Reviewed-on: #21 Reviewed-by: Get in my car i have candy <huydw@proton.me>
23 lines
644 B
TypeScript
23 lines
644 B
TypeScript
import {inject, Injectable} from "@angular/core";
|
|
import {HttpClient} from "@angular/common/http";
|
|
import {Observable} from "rxjs";
|
|
import {Employee} from "../employee/Employee";
|
|
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export default class EmployeeApiService {
|
|
private http: HttpClient = inject(HttpClient);
|
|
|
|
private static readonly BASE_URL = 'http://localhost:8089';
|
|
|
|
public deleteById(id: number): Observable<Employee> {
|
|
return this.http.delete(`${EmployeeApiService.BASE_URL}/employees/${id}`)
|
|
}
|
|
|
|
public getAll(): Observable<Employee[]> {
|
|
return this.http.get<Employee[]>(`${EmployeeApiService.BASE_URL}/employees`)
|
|
}
|
|
}
|