fixing setup-user component

added porOrgacode to payload for createUser
mazdak/UX-1861
Mazdak Gibran 4 weeks ago
parent 5955ad90a5
commit 0163c1c469

@ -7,7 +7,8 @@ export class User {
export interface SetupUser { export interface SetupUser {
userId: string; userId: string;
userFullname: string; userFullname: string;
defaultPassword: string; password: string;
porOrgacode: string | null;
email: string; email: string;
role: string; role: string;
} }

@ -8,6 +8,7 @@ import { SetupUser } from '../../models/user';
import { UserSetupService } from '../../services/user-setup.service'; import { UserSetupService } from '../../services/user-setup.service';
import { UserFilterPipe } from '../../shared/pipes/userFilterPipe'; import { UserFilterPipe } from '../../shared/pipes/userFilterPipe';
import { FormBuilder, Validators, FormGroup } from '@angular/forms'; import { FormBuilder, Validators, FormGroup } from '@angular/forms';
import { StorageService } from '../../shared/services/storage.service';
@Component({ @Component({
@ -34,7 +35,7 @@ export class SetupUserComponent implements OnInit {
mode: 'edit' | 'view' = 'view'; mode: 'edit' | 'view' = 'view';
constructor(private userService: UserSetupService, private fb: FormBuilder){} constructor(private userService: UserSetupService, private fb: FormBuilder, private storageService: StorageService){}
get users$(){ get users$(){
return this.userService.users$; return this.userService.users$;
@ -70,8 +71,11 @@ export class SetupUserComponent implements OnInit {
userFullname: this.userForm.value.userFullname, userFullname: this.userForm.value.userFullname,
email: `${this.userForm.value.userId}@dummy.com`, email: `${this.userForm.value.userId}@dummy.com`,
role: 'ADMIN', role: 'ADMIN',
defaultPassword: this.userForm.value.defaultPassword porOrgacode: this.storageService.getItem('POR_ORGACODE'),
password: this.userForm.value.defaultPassword
} }
console.log('Payload:', newUser); // 👈 Debug
this.userService.addUser(newUser).subscribe({ this.userService.addUser(newUser).subscribe({
next: () => { next: () => {
this.userService.loadUsers(); this.userService.loadUsers();

Loading…
Cancel
Save