bozza display utente
This commit is contained in:
@@ -6,20 +6,24 @@
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="px-2">
|
||||
<div class="px-2 py-1">
|
||||
<i class="fas fa-user-alt"></i> <b>@userName</b>
|
||||
@if (userName != "0")
|
||||
{
|
||||
<button class="btn btn-primary btn-sm mx-1" @onclick="() => LogOut()" title="Forza Refresh Dati correnti"> LogOut </button>
|
||||
}
|
||||
</div>
|
||||
<div class="pe-2">
|
||||
<button class="btn btn-primary" @onclick="() => flushCache()" title="Forza Refresh Dati correnti"> Force Reload </button>
|
||||
</div>
|
||||
@* <div class="px-2 flex-grow-1 text-end">
|
||||
<span class="text-secondary">@TipoSearch</span>
|
||||
@* <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>
|
||||
}
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
}
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
@@ -17,6 +18,13 @@ namespace MP.INVE.Components
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
public async Task LogOut()
|
||||
{
|
||||
await sessionStorage.ClearAsync();
|
||||
// rimando a pagina login
|
||||
NavManager.NavigateTo("OperatoreLogin", true);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
@@ -24,6 +32,9 @@ namespace MP.INVE.Components
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private ISessionStorageService sessionStorage { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -32,6 +43,12 @@ namespace MP.INVE.Components
|
||||
{
|
||||
await forceReload();
|
||||
}
|
||||
protected async Task getId()
|
||||
{
|
||||
int answ = 0;
|
||||
answ = await sessionStorage.GetItemAsync<int>("MatrOpr");
|
||||
userName = answ.ToString();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -53,17 +70,8 @@ namespace MP.INVE.Components
|
||||
#region Private Methods
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
{
|
||||
await getId();
|
||||
}
|
||||
|
||||
private async void MService_EA_ShowSearch()
|
||||
|
||||
Reference in New Issue
Block a user