diff --git a/support-portal-frontend/src/app/component/management/users/users-table/users-table.component.ts b/support-portal-frontend/src/app/component/management/users/users-table/users-table.component.ts index b00ffc3..5d9e56b 100644 --- a/support-portal-frontend/src/app/component/management/users/users-table/users-table.component.ts +++ b/support-portal-frontend/src/app/component/management/users/users-table/users-table.component.ts @@ -7,6 +7,7 @@ import {UserService} from "../../../../service/user.service"; import {NotificationService} from "../../../../service/notification.service"; import {AuthenticationService} from "../../../../service/authentication.service"; import {Router} from "@angular/router"; +import {CustomHttpResponse} from "../../../../dto/custom-http-response"; @Component({ selector: 'app-users-table', @@ -69,7 +70,15 @@ export class UsersTableComponent implements OnInit, OnDestroy { } onDeleteUser(user: User) { - console.log(`User ${user.username} is clicked to be deleted`); + this.subs.sink = this.userService.deleteUser(user.userId) + .subscribe( + (response: CustomHttpResponse) => { + this.getUsers(false); + this.notificationService.notify(NotificationType.SUCCESS, response.message); + }, + (errorResponse: HttpErrorResponse) => { + this.notificationService.notify(NotificationType.ERROR, errorResponse.error.message); + } + ); } - }