|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|