Files
mapo-core/MP.SPEC/Components/CmpTop.razor
T
Samuele Locatelli 2016379205 ART:
- aggiunta ricerca x selVal
- completata ricerca veto cancellazione
2022-07-23 17:19:19 +02:00

53 lines
1.1 KiB
Plaintext

@using MP.SPEC.Components
@using MP.SPEC.Data
@using System.Security.Claims
@using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject MessageService MService
<div class="d-flex w-100 justify-content-between">
<div class="px-2">
<i class="fas fa-user-alt"></i> <b>@userName</b>
</div>
<div class="px-2 flex-grow-1">
</div>
<div class="px-2 text-end">
@if (ShowSearch)
{
<SearchMod></SearchMod>
}
</div>
</div>
@code {
protected bool ShowSearch
{
get => MService.ShowSearch;
set => MService.ShowSearch = value;
}
private string userName = "";
protected override async Task OnInitializedAsync()
{
await forceReload();
}
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
}
else
{
userName = "N.A.";
}
}
}