mirror of https://github.com/abpframework/abp.git
1 changed files with 19 additions and 2 deletions
@ -1,19 +1,36 @@ |
|||||
using System.Threading.Tasks; |
using System; |
||||
|
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Components; |
using Microsoft.AspNetCore.Components; |
||||
|
using Microsoft.AspNetCore.Components.Authorization; |
||||
using Volo.Abp.UI.Navigation; |
using Volo.Abp.UI.Navigation; |
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic |
namespace Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic |
||||
{ |
{ |
||||
public partial class NavMenu |
public partial class NavMenu : IDisposable |
||||
{ |
{ |
||||
[Inject] |
[Inject] |
||||
protected IMenuManager MenuManager { get; set; } |
protected IMenuManager MenuManager { get; set; } |
||||
|
|
||||
|
[Inject] |
||||
|
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } |
||||
|
|
||||
protected ApplicationMenu Menu { get; set; } |
protected ApplicationMenu Menu { get; set; } |
||||
|
|
||||
protected override async Task OnInitializedAsync() |
protected override async Task OnInitializedAsync() |
||||
{ |
{ |
||||
Menu = await MenuManager.GetMainMenuAsync(); |
Menu = await MenuManager.GetMainMenuAsync(); |
||||
|
AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateProviderOnAuthenticationStateChanged; |
||||
|
} |
||||
|
|
||||
|
public void Dispose() |
||||
|
{ |
||||
|
AuthenticationStateProvider.AuthenticationStateChanged -= AuthenticationStateProviderOnAuthenticationStateChanged; |
||||
|
} |
||||
|
|
||||
|
private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task) |
||||
|
{ |
||||
|
Menu = await MenuManager.GetMainMenuAsync(); |
||||
|
StateHasChanged(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue