This commit is contained in:
MeysamMoghaddam
2025-10-12 18:16:59 +03:30
parent 707eac088a
commit 2497cec116
5 changed files with 250 additions and 271 deletions

View File

@@ -1,4 +1,6 @@
using FluentValidation;
using FrontOffice.BFF.Package.Protobuf.Protos.Package;
using FrontOffice.BFF.User.Protobuf.Protos.User;
using FrontOffice.Main.Utilities;
using Microsoft.AspNetCore.Components;
using MudBlazor;
@@ -9,7 +11,9 @@ namespace FrontOffice.Main.Pages.Profile;
public partial class Index
{
private UserProfile _userProfile = new();
[Inject] private UserContract.UserContractClient UserContract { get; set; } = default!;
private GetUserResponse _userProfile = new();
private PasswordChangeModel _passwordModel = new();
private AccountSettings _settings = new();
@@ -23,29 +27,20 @@ public partial class Index
private readonly UserProfileValidator _personalValidator = new();
private readonly PasswordChangeValidator _passwordValidator = new();
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadUserProfile();
await LoadAccountSettings();
await base.OnAfterRenderAsync(firstRender);
if(firstRender)
{
await LoadUserProfile();
await LoadAccountSettings();
}
}
private async Task LoadUserProfile()
{
// TODO: Load user profile from API
_userProfile = new UserProfile
{
FirstName = "علی",
LastName = "احمدی",
Email = "ali.ahmad@example.com",
PhoneNumber = "09123456789",
NationalCode = "0123456789",
BirthDate = "1370/01/01",
Address = "تهران، خیابان ولیعصر",
JoinDate = "۱۴۰۲/۰۱/۱۵",
LastLogin = "۱۴۰۲/۱۰/۰۶",
TotalReferrals = 25,
Level = "طلایی"
};
_userProfile = await UserContract.GetUserAsync(request: new());
StateHasChanged();
}
private async Task LoadAccountSettings()