Fix sync utenti

This commit is contained in:
2025-12-29 13:45:02 +01:00
parent 5c1d74e04d
commit 37d66c90d2
4 changed files with 59 additions and 26 deletions

View File

@@ -3,12 +3,14 @@
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Authorization.Enum
@using salesbook.Shared.Core.Dto.PageState
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Interface.System.Network
@using salesbook.Shared.Core.Services
@inject AppAuthenticationStateProvider AuthenticationStateProvider
@inject INetworkService NetworkService
@inject IFormFactor FormFactor
@inject UserListState UserState
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
@@ -155,18 +157,10 @@
private void UpdateDb(bool withData = false)
{
LocalStorage.Remove("last-user-sync");
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
UserState.IsLoaded = false;
UserState.IsLoading = false;
string path;
if (withData)
path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
else
path = pathAndQuery == null ? "/sync" : "/sync?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
NavigationManager.NavigateTo(path, replace: true);
NavigationManager.NavigateTo(withData ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : "/sync", replace: true);
}
}