|
|
|
@ -15,35 +15,31 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic |
|
|
|
[Inject] |
|
|
|
protected IMenuManager MenuManager { get; set; } |
|
|
|
|
|
|
|
[CanBeNull] |
|
|
|
protected AuthenticationStateProvider AuthenticationStateProvider; |
|
|
|
[Inject] |
|
|
|
public AuthenticationStateProvider AuthenticationStateProvider { get; set; } |
|
|
|
|
|
|
|
[CanBeNull] |
|
|
|
protected SignOutSessionStateManager SignOutManager; |
|
|
|
|
|
|
|
protected ApplicationMenu Menu { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
Menu = await MenuManager.GetAsync(StandardMenus.User); |
|
|
|
|
|
|
|
Navigation.LocationChanged += OnLocationChanged; |
|
|
|
|
|
|
|
LazyGetService(ref AuthenticationStateProvider); |
|
|
|
LazyGetService(ref SignOutManager); |
|
|
|
|
|
|
|
if (AuthenticationStateProvider != null) |
|
|
|
{ |
|
|
|
AuthenticationStateProvider.AuthenticationStateChanged += |
|
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
} |
|
|
|
AuthenticationStateProvider.AuthenticationStateChanged += |
|
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e) |
|
|
|
{ |
|
|
|
InvokeAsync(StateHasChanged); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task) |
|
|
|
{ |
|
|
|
Menu = await MenuManager.GetAsync(StandardMenus.User); |
|
|
|
@ -53,13 +49,10 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
Navigation.LocationChanged -= OnLocationChanged; |
|
|
|
if (AuthenticationStateProvider != null) |
|
|
|
{ |
|
|
|
AuthenticationStateProvider.AuthenticationStateChanged -= |
|
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
} |
|
|
|
AuthenticationStateProvider.AuthenticationStateChanged -= |
|
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task NavigateToAsync(string uri, string target = null) |
|
|
|
{ |
|
|
|
if (target == "_blank") |
|
|
|
|