@page "/user"
@attribute [Authorize]
@using SteUp.Shared.Components.Layout
@using SteUp.Shared.Components.SingleElements
@using SteUp.Shared.Core.Authorization.Enum
@using SteUp.Shared.Core.Helpers
@using SteUp.Shared.Core.Interface.System.Network
@using SteUp.Shared.Core.Services
@using SteUp.Shared.Core.Utility
@inject AppAuthenticationStateProvider AuthenticationStateProvider
@inject INetworkService NetworkService
@if (IsLoggedIn)
{
@UtilityString.ExtractInitials(UserSession.User.Fullname)
@UserSession.User.Fullname
@if (UserSession.User.KeyGroup is not null)
{
@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())
}
Status
@if (NetworkService.ConnectionAvailable)
{
Online
}
else
{
Offline
}
Sincronizza ispezioni
Esci
}
@code {
private bool IsLoggedIn { get; set; }
private string? CodHash { get; set; } = "";
protected override async Task OnInitializedAsync()
{
IsLoggedIn = await UserSession.IsLoggedIn();
CodHash = LocalStorage.GetString("codHash");
StateHasChanged();
}
private void UpdateDb()
{
}
private async Task Logout()
{
await AuthenticationStateProvider.SignOut();
IsLoggedIn = await UserSession.IsLoggedIn();
StateHasChanged();
}
}