diff --git a/src/app/features/store/pages/account-page/components/account-sidebar/account-sidebar.scss b/src/app/features/store/pages/account-page/components/account-sidebar/account-sidebar.scss index e44aad8..0595a85 100644 --- a/src/app/features/store/pages/account-page/components/account-sidebar/account-sidebar.scss +++ b/src/app/features/store/pages/account-page/components/account-sidebar/account-sidebar.scss @@ -29,6 +29,6 @@ color: #5a5a5a; } .nav-link.active { - color: #5b75ff; /* Blue color matching the image */ + color: var(--color-primary); /* Blue color matching the image */ font-weight: 600; } diff --git a/src/app/features/store/pages/account-page/components/profile-form/profile-form.ts b/src/app/features/store/pages/account-page/components/profile-form/profile-form.ts index cda9727..01e3bcf 100644 --- a/src/app/features/store/pages/account-page/components/profile-form/profile-form.ts +++ b/src/app/features/store/pages/account-page/components/profile-form/profile-form.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, inject } from '@angular/core'; +import { Component, inject, effect } from '@angular/core'; import { ReactiveFormsModule, FormBuilder, FormGroup } from '@angular/forms'; import { InputComponent } from '../../../../../../shared/components/input/input.component'; import { ButtonComponent } from '../../../../../../shared/components/button/button.component'; @@ -11,7 +11,7 @@ import { AuthService } from '../../../../../../core/services/auth/auth.service'; templateUrl: './profile-form.html', styleUrl: './profile-form.scss', }) -export class ProfileForm implements OnInit { +export class ProfileForm { profileForm: FormGroup; private authService = inject(AuthService); @@ -23,19 +23,18 @@ export class ProfileForm implements OnInit { phone: [''], password: [''] }); - } - ngOnInit(): void { - this.authService.loadCurrentUser().subscribe({ - next: (user) => { + effect(() => { + const user = this.authService.user(); + if (user) { this.profileForm.patchValue({ fullName: user.nombre_apellido, email: user.email, dni: user.dni || '', phone: user.telefono || '' }); - }, - error: (err) => console.error('Error fetching user profile', err) + } }); } + }