add functionality to delete employee button #11
@ -8,7 +8,7 @@ import {
|
||||
MatDialogTitle
|
||||
} from "@angular/material/dialog";
|
||||
import {MatButton} from "@angular/material/button";
|
||||
import ApiService from "../services/api.service";
|
||||
import EmployeeApiService from "../services/employee-api.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-delete-employee',
|
||||
@ -24,7 +24,7 @@ import ApiService from "../services/api.service";
|
||||
styleUrl: './delete-employee.component.css'
|
||||
})
|
||||
export class DeleteEmployeeComponent {
|
||||
private apiService: ApiService = inject(ApiService);
|
||||
private apiService: EmployeeApiService = inject(EmployeeApiService);
|
||||
|
||||
@Output()
|
||||
private deleteEvent: EventEmitter<null> = new EventEmitter();
|
||||
|
@ -7,10 +7,12 @@ import {Employee} from "../Employee";
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export default class ApiService {
|
||||
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(`http://localhost:8089/employees/${id}`)
|
||||
return this.http.delete(`${EmployeeApiService.BASE_URL}/employees/${id}`)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user