Browse Source
Update WebAssemblyRedirectToLogin.razor
pull/18876/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
10 additions and
1 deletions
-
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/WebAssemblyRedirectToLogin.razor
|
|
|
@ -3,14 +3,23 @@ |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic |
|
|
|
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication |
|
|
|
@using Microsoft.Extensions.Options |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server |
|
|
|
@inherits RedirectToLogin |
|
|
|
@attribute [ExposeServices(typeof(RedirectToLogin))] |
|
|
|
@attribute [Dependency(ReplaceServices = true)] |
|
|
|
@inject IOptions<AuthenticationOptions> AuthenticationOptions |
|
|
|
@inject IOptions<AbpAspNetCoreComponentsWebOptions> AbpAspNetCoreComponentsWebOptions |
|
|
|
|
|
|
|
@code { |
|
|
|
protected override void OnInitialized() |
|
|
|
{ |
|
|
|
Navigation.NavigateToLogin(AuthenticationOptions.Value.LoginUrl); |
|
|
|
if (AbpAspNetCoreComponentsWebOptions.Value.IsBlazorWebApp) |
|
|
|
{ |
|
|
|
Navigation.NavigateTo(AuthenticationOptions.Value.LogoutUrl, forceLoad: true); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Navigation.NavigateToLogin(AuthenticationOptions.Value.LoginUrl); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|