Browse Source

Merge pull request #19958 from abpframework/auto-merge/rel-8-2/2756

Merge branch dev with rel-8.2
pull/19959/head
maliming 2 years ago
committed by GitHub
parent
commit
bcaab26b85
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 26
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ClientProxyExceptionEventHandler.cs

26
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ClientProxyExceptionEventHandler.cs

@ -26,31 +26,19 @@ public class ClientProxyExceptionEventHandler : ILocalEventHandler<ClientProxyEx
{
using (var scope = ServiceProvider.CreateScope())
{
switch (eventData.StatusCode)
if (eventData.StatusCode == 401)
{
case 401:
var options = scope.ServiceProvider.GetRequiredService<IOptions<AbpAspNetCoreComponentsWebOptions>>();
if (!options.Value.IsBlazorWebApp)
{
var options = scope.ServiceProvider.GetRequiredService<IOptions<AbpAspNetCoreComponentsWebOptions>>();
if (!options.Value.IsBlazorWebApp)
{
var authenticationOptions = scope.ServiceProvider.GetRequiredService<IOptions<AbpAuthenticationOptions>>();
var navigationManager = scope.ServiceProvider.GetRequiredService<NavigationManager>();
navigationManager.NavigateToLogout(authenticationOptions.Value.LogoutUrl, "/");
}
else
{
var jsRuntime = scope.ServiceProvider.GetRequiredService<IJSRuntime>();
await jsRuntime.InvokeVoidAsync("eval", "setTimeout(function(){location.assign('/')}, 2000)");
}
break;
var authenticationOptions = scope.ServiceProvider.GetRequiredService<IOptions<AbpAuthenticationOptions>>();
var navigationManager = scope.ServiceProvider.GetRequiredService<NavigationManager>();
navigationManager.NavigateToLogout(authenticationOptions.Value.LogoutUrl, "/");
}
case 403:
else
{
var jsRuntime = scope.ServiceProvider.GetRequiredService<IJSRuntime>();
await jsRuntime.InvokeVoidAsync("eval", "setTimeout(function(){location.assign('/')}, 2000)");
break;
}
}
}

Loading…
Cancel
Save