65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
|
|
namespace TIAMSharedUI.Shared.Components
|
|
{
|
|
public partial class Navbar : ComponentBase
|
|
{
|
|
|
|
[Inject]
|
|
public NavigationManager navigationManager { get; set; }
|
|
|
|
[Inject]
|
|
public IComponentUpdateService componentUpdateService { get; set; }
|
|
|
|
private bool collapseNavMenu = true;
|
|
private bool myUser = false;
|
|
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
|
|
|
//componentUpdateService.RefreshRequested += RefreshMe;
|
|
|
|
|
|
private void RefreshMe()
|
|
{
|
|
StateHasChanged();
|
|
}
|
|
|
|
private void ToggleNavMenu()
|
|
{
|
|
collapseNavMenu = !collapseNavMenu;
|
|
}
|
|
|
|
private void NavigateBack()
|
|
{
|
|
|
|
}
|
|
|
|
private void SignOut()
|
|
{
|
|
SecureStorageHandler.ClearAllSecureStorageAsync();
|
|
sessionService.User = null;
|
|
sessionService.IsAuthenticated = false;
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
if (sessionService.User != null)
|
|
{
|
|
myUser = true;
|
|
}
|
|
else
|
|
{
|
|
myUser = false;
|
|
}
|
|
componentUpdateService.RefreshRequested += RefreshMe;
|
|
}
|
|
|
|
}
|
|
}
|