u
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.User.Protobuf.Protos.User;
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
@@ -24,14 +25,13 @@ public partial class Index
|
||||
private string _copyMessage = string.Empty;
|
||||
|
||||
private readonly UserProfileValidator _personalValidator = new();
|
||||
|
||||
private DateTime? _date;
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
if(firstRender)
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadUserProfile();
|
||||
await LoadAccountSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public partial class Index
|
||||
{
|
||||
_userProfile = await UserContract.GetUserAsync(request: new());
|
||||
_updateUserRequest = _userProfile.Adapt<UpdateUserRequest>();
|
||||
if (_userProfile.BirthDate != null)
|
||||
_date = _userProfile.BirthDate.ToDateTime();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -51,21 +53,6 @@ public partial class Index
|
||||
}
|
||||
|
||||
|
||||
private async Task LoadAccountSettings()
|
||||
{
|
||||
// TODO: Load settings from API
|
||||
//_settings = new AccountSettings
|
||||
//{
|
||||
// EmailNotifications = true,
|
||||
// SmsNotifications = true,
|
||||
// PushNotifications = false,
|
||||
// ProfileVisibility = true,
|
||||
// ShowOnlineStatus = true,
|
||||
// Language = "fa",
|
||||
// Theme = "light"
|
||||
//};
|
||||
}
|
||||
|
||||
private async Task SavePersonalInfo()
|
||||
{
|
||||
if (_personalForm is null) return;
|
||||
@@ -77,6 +64,9 @@ public partial class Index
|
||||
|
||||
try
|
||||
{
|
||||
if (_date != null)
|
||||
_updateUserRequest.BirthDate = _date.Value.DateTimeToTimestamp();
|
||||
|
||||
await UserContract.UpdateUserAsync(request: _updateUserRequest);
|
||||
await LoadUserProfile();
|
||||
Snackbar.Add("اطلاعات شخصی با موفقیت ذخیره شد.", Severity.Success);
|
||||
@@ -105,8 +95,8 @@ public partial class Index
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: Save settings to API
|
||||
await Task.Delay(1000); // Simulate API call
|
||||
|
||||
await SavePersonalInfo();
|
||||
|
||||
Snackbar.Add("تنظیمات با موفقیت ذخیره شد.", Severity.Success);
|
||||
}
|
||||
@@ -121,12 +111,6 @@ public partial class Index
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelSettingsChanges()
|
||||
{
|
||||
// TODO: Reset settings to original values
|
||||
Snackbar.Add("تغییرات تنظیمات لغو شد.", Severity.Info);
|
||||
}
|
||||
|
||||
private async Task CopyReferralCode()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user