diff --git a/support-portal-frontend/src/app/component/user/user.component.ts b/support-portal-frontend/src/app/component/user/user.component.ts
index c6ce48b..1a662d4 100644
--- a/support-portal-frontend/src/app/component/user/user.component.ts
+++ b/support-portal-frontend/src/app/component/user/user.component.ts
@@ -136,4 +136,21 @@ export class UserComponent implements OnInit, OnDestroy {
this.currentUsername = user.username;
this.clickButton('openUserEdit');
}
+
+ public onUpdateUser(): void {
+ const formData = this.userService.createUserFormData(this.currentUsername, this.editUser, this.profileImage);
+ let subscription = this.userService.updateUser(formData)
+ .subscribe(
+ (user: User) => {
+ this.clickButton('closeEditUserButton');
+ this.getUsers(false);
+ this.invalidateVariables();
+ this.notificationService.notify(NotificationType.SUCCESS, `User ${user.username} updated successfully`);
+ },
+ (errorResponse: HttpErrorResponse) => {
+ this.sendErrorNotification(errorResponse.error.message);
+ }
+ );
+ this.subscriptions.push(subscription);
+ }
}
diff --git a/support-portal-frontend/src/app/service/user.service.ts b/support-portal-frontend/src/app/service/user.service.ts
index 503f605..d9e4c4c 100644
--- a/support-portal-frontend/src/app/service/user.service.ts
+++ b/support-portal-frontend/src/app/service/user.service.ts
@@ -26,10 +26,10 @@ export class UserService {
.post
(`${this.host}/user/add`, formData);
}
- public updateUser(formData: FormData): Observable {
+ public updateUser(formData: FormData): Observable {
let currentUsername = formData.get(`currentUsername`);
return this.httpClient
- .put(`${this.host}/user/${currentUsername}`, formData);
+ .put(`${this.host}/user/${currentUsername}`, formData);
}
public resetPassword(email: string): Observable {