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 22f8a80..901f785 100644 --- a/support-portal-frontend/src/app/component/user/user.component.ts +++ b/support-portal-frontend/src/app/component/user/user.component.ts @@ -33,7 +33,6 @@ export class UserComponent implements OnInit, OnDestroy { public profileImageFileName: string | null; public profileImage: File | null; public editUser: User = new User(); - private currentUsername: string; public fileUploadStatus: FileUploadStatus = new FileUploadStatus(); @@ -97,7 +96,7 @@ export class UserComponent implements OnInit, OnDestroy { } public onAddNewUser(userForm: NgForm): void { - let formData = this.userService.createUserFormData(null, userForm.value, this.profileImage); + let formData = this.userService.createUserFormData(userForm.value, this.profileImage); this.subs.sink = this.userService.addUser(formData) .subscribe( (user: User) => { @@ -150,12 +149,11 @@ export class UserComponent implements OnInit, OnDestroy { public onEditUser(user: User): void { this.editUser = user; - this.currentUsername = user.username; this.clickButton('openUserEdit'); } public onUpdateUser(): void { - const formData = this.userService.createUserFormData(this.currentUsername, this.editUser, this.profileImage); + const formData = this.userService.createUserFormData(this.editUser, this.profileImage); this.subs.sink = this.userService.updateUser(this.editUser.userId, formData) .subscribe( (user: User) => { @@ -204,7 +202,6 @@ export class UserComponent implements OnInit, OnDestroy { } onUpdateCurrentUser(user: User) { - this.currentUsername = this.authenticationService.getUserFromLocalStorage().username; const userId = this.authenticationService.getUserFromLocalStorage().userId; this.refreshing = true; @@ -212,10 +209,7 @@ export class UserComponent implements OnInit, OnDestroy { if (user.active == undefined) user.active = this.loggedInUser.active; if (user.notLocked == undefined) user.notLocked = this.loggedInUser.notLocked; - console.log(user); - console.log(this.loggedInUser); - - const formData = this.userService.createUserFormData(this.currentUsername, user, this.profileImage); + const formData = this.userService.createUserFormData(user, this.profileImage); this.subs.sink = this.userService.updateUser(userId, formData) .subscribe( (user: User) => { diff --git a/support-portal-frontend/src/app/service/user.service.ts b/support-portal-frontend/src/app/service/user.service.ts index 1d66463..5f96b53 100644 --- a/support-portal-frontend/src/app/service/user.service.ts +++ b/support-portal-frontend/src/app/service/user.service.ts @@ -62,12 +62,10 @@ export class UserService { return []; } - public createUserFormData(loggedInUsername: string | null, user: User, profileImage: File | null): FormData { + public createUserFormData(user: User, profileImage: File | null): FormData { const formData = new FormData(); - if (loggedInUsername) - formData.append('currentUsername', loggedInUsername); formData.append('firstName', user.firstName); formData.append('lastName', user.lastName); formData.append("username", user.username);