|
|
@ -1,11 +1,10 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using JetBrains.Annotations; |
|
|
|
|
|
using Microsoft.AspNetCore.Components; |
|
|
using Microsoft.AspNetCore.Components; |
|
|
using Microsoft.AspNetCore.Components.Authorization; |
|
|
|
|
|
using Microsoft.AspNetCore.Components.Routing; |
|
|
using Microsoft.AspNetCore.Components.Routing; |
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication; |
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication; |
|
|
using Microsoft.JSInterop; |
|
|
using Microsoft.JSInterop; |
|
|
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Security; |
|
|
using Volo.Abp.UI.Navigation; |
|
|
using Volo.Abp.UI.Navigation; |
|
|
|
|
|
|
|
|
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Themes.AntDesignTheme; |
|
|
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Themes.AntDesignTheme; |
|
|
@ -16,10 +15,7 @@ public partial class LoginDisplay : IDisposable |
|
|
protected IMenuManager MenuManager { get; set; } |
|
|
protected IMenuManager MenuManager { get; set; } |
|
|
|
|
|
|
|
|
[Inject] |
|
|
[Inject] |
|
|
public AuthenticationStateProvider AuthenticationStateProvider { get; set; } |
|
|
protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; set; } |
|
|
|
|
|
|
|
|
[CanBeNull] |
|
|
|
|
|
protected SignOutSessionStateManager SignOutManager; |
|
|
|
|
|
|
|
|
|
|
|
protected ApplicationMenu Menu { get; set; } |
|
|
protected ApplicationMenu Menu { get; set; } |
|
|
|
|
|
|
|
|
@ -29,10 +25,7 @@ public partial class LoginDisplay : IDisposable |
|
|
|
|
|
|
|
|
Navigation.LocationChanged += OnLocationChanged; |
|
|
Navigation.LocationChanged += OnLocationChanged; |
|
|
|
|
|
|
|
|
LazyGetService(ref SignOutManager); |
|
|
ApplicationConfigurationChangedService.Changed += ApplicationConfigurationChanged; |
|
|
|
|
|
|
|
|
AuthenticationStateProvider.AuthenticationStateChanged += |
|
|
|
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e) |
|
|
protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e) |
|
|
@ -40,7 +33,7 @@ public partial class LoginDisplay : IDisposable |
|
|
InvokeAsync(StateHasChanged); |
|
|
InvokeAsync(StateHasChanged); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task) |
|
|
private async void ApplicationConfigurationChanged() |
|
|
{ |
|
|
{ |
|
|
Menu = await MenuManager.GetAsync(StandardMenus.User); |
|
|
Menu = await MenuManager.GetAsync(StandardMenus.User); |
|
|
await InvokeAsync(StateHasChanged); |
|
|
await InvokeAsync(StateHasChanged); |
|
|
@ -49,8 +42,7 @@ public partial class LoginDisplay : IDisposable |
|
|
public void Dispose() |
|
|
public void Dispose() |
|
|
{ |
|
|
{ |
|
|
Navigation.LocationChanged -= OnLocationChanged; |
|
|
Navigation.LocationChanged -= OnLocationChanged; |
|
|
AuthenticationStateProvider.AuthenticationStateChanged -= |
|
|
ApplicationConfigurationChangedService.Changed -= ApplicationConfigurationChanged; |
|
|
AuthenticationStateProviderOnAuthenticationStateChanged; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task NavigateToAsync(string uri, string target = null) |
|
|
private async Task NavigateToAsync(string uri, string target = null) |
|
|
@ -65,12 +57,8 @@ public partial class LoginDisplay : IDisposable |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task BeginSignOut() |
|
|
private void BeginSignOut() |
|
|
{ |
|
|
{ |
|
|
if (SignOutManager != null) |
|
|
Navigation.NavigateToLogout("authentication/logout"); |
|
|
{ |
|
|
|
|
|
await SignOutManager.SetSignOutState(); |
|
|
|
|
|
await NavigateToAsync("authentication/logout"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|