Commit 5014d193 authored by Roopashree L's avatar Roopashree L
Browse files

update user request changes

Showing with 18 additions and 13 deletions
+18 -13
......@@ -42,7 +42,7 @@
<h4>Email Id</h4>
<mat-form-field appearance="outline" class="text-class">
<mat-label>Email id</mat-label>
<input matInput placeholder="pat@example.com" [readonly]="isEditUser === true? true: false" formControlName="username" required>
<input matInput placeholder="pat@example.com" formControlName="username" required>
<mat-error *ngIf="username && username.invalid && username.touched">please Enter email Id</mat-error>
</mat-form-field>
......
......@@ -142,13 +142,16 @@ export class UserFormComponent implements OnInit {
request: {
firstName,
lastName,
enabled: status === 'Active'? true: false,
attributes: {
departmentName: 'grievances',
phoneNumber: phone,
Role: role // not sure if this can be updated
Role: role
},
}
}
console.log(requestObj)
console.log(this.userDetails);
this.isProcessing = true;
this.userService.updateUser(requestObj).subscribe({
next: (res) => {
......
......@@ -49,7 +49,6 @@ export class UserProfileComponent {
next: (res) => {
this.userDetails = res.responseData;
if(this.userDetails) {
console.log(this.userDetails);
this.setUserFormData();
}
},
......@@ -106,19 +105,22 @@ export class UserProfileComponent {
}
onSubmit() {
console.log(this.userForm.value);
const updateUserRequest = {
userName: this.userDetails.id,
const {firstName, lastName, phoneNumber, username} = this.userForm.value;
const {id, attributes, enabled } = this.userDetails;
const requestObj = {
userName: id,
request: {
firstName: this.userForm.value.firstName,
lastName: this.userForm.value.lastName,
email: this.userForm.value.emailId,
attributes: {
phoneNumber: this.userForm.value.phoneNumber
}
firstName,
lastName,
enabled: enabled,
attributes: {
departmentName: attributes.departmentNAme[0],
phoneNumber: phoneNumber,
Role: attributes.Role[0]
},
}
}
this.userService.updateUser(updateUserRequest).subscribe({
this.userService.updateUser(requestObj).subscribe({
next:(res) => {
console.log(res);
this.toastrService.showToastr('User details updated successfully', 'Success', 'success', '');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment