67 lines
1.5 KiB
Plaintext
67 lines
1.5 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 text-end">
|
|
<span class="text-secondary">@TipoSearch</span>
|
|
</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 = "";
|
|
|
|
private string TipoSearch
|
|
{
|
|
get => MService.TipoSearch;
|
|
set => MService.TipoSearch = value;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
MService.EA_ShowSearch += MService_EA_ShowSearch;
|
|
await forceReload();
|
|
}
|
|
private async void MService_EA_ShowSearch()
|
|
{
|
|
//await forceReload();
|
|
await Task.Delay(1);
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
|
|
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.";
|
|
}
|
|
}
|
|
}
|