change file structure
Reviewed-on: #21 Reviewed-by: Get in my car i have candy <huydw@proton.me>
This commit is contained in:
36
src/app/employee/delete/delete.component.ts
Normal file
36
src/app/employee/delete/delete.component.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import {Component, Inject, inject} from '@angular/core';
|
||||
import {Employee} from "../Employee";
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
MatDialogContent,
|
||||
MatDialogTitle
|
||||
} from "@angular/material/dialog";
|
||||
import {MatButton} from "@angular/material/button";
|
||||
import EmployeeApiService from "../../services/employee-api.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-delete-employee',
|
||||
imports: [
|
||||
MatDialogContent,
|
||||
MatDialogTitle,
|
||||
MatDialogActions,
|
||||
MatButton,
|
||||
MatDialogClose
|
||||
],
|
||||
templateUrl: './delete.component.html',
|
||||
standalone: true,
|
||||
styleUrl: './delete.component.css'
|
||||
})
|
||||
export class DeleteComponent {
|
||||
private apiService: EmployeeApiService = inject(EmployeeApiService);
|
||||
|
||||
protected employee: Employee = inject(MAT_DIALOG_DATA);
|
||||
|
||||
deleteEmployee(id: number) {
|
||||
this.apiService.deleteById(id).subscribe();
|
||||
|
||||
location.reload();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user