refactor
This commit is contained in:
parent
0ec0d07c60
commit
e474385692
@ -8,7 +8,7 @@ import {
|
|||||||
MatDialogTitle
|
MatDialogTitle
|
||||||
} from "@angular/material/dialog";
|
} from "@angular/material/dialog";
|
||||||
import {MatButton} from "@angular/material/button";
|
import {MatButton} from "@angular/material/button";
|
||||||
import ApiService from "../services/api.service";
|
import EmployeeApiService from "../services/employee-api.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-delete-employee',
|
selector: 'app-delete-employee',
|
||||||
@ -24,7 +24,7 @@ import ApiService from "../services/api.service";
|
|||||||
styleUrl: './delete-employee.component.css'
|
styleUrl: './delete-employee.component.css'
|
||||||
})
|
})
|
||||||
export class DeleteEmployeeComponent {
|
export class DeleteEmployeeComponent {
|
||||||
private apiService: ApiService = inject(ApiService);
|
private apiService: EmployeeApiService = inject(EmployeeApiService);
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
private deleteEvent: EventEmitter<null> = new EventEmitter();
|
private deleteEvent: EventEmitter<null> = new EventEmitter();
|
||||||
|
@ -7,10 +7,12 @@ import {Employee} from "../Employee";
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export default class ApiService {
|
export default class EmployeeApiService {
|
||||||
private http: HttpClient = inject(HttpClient);
|
private http: HttpClient = inject(HttpClient);
|
||||||
|
|
||||||
|
private static readonly BASE_URL = 'http://localhost:8089';
|
||||||
|
|
||||||
public deleteById(id: number): Observable<Employee> {
|
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