Redirect on NotLoggedInException
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
@using System.Net
|
@using System.Net
|
||||||
|
@using BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||||
@using VisaApiClient
|
@using VisaApiClient
|
||||||
<CascadingValue Value="this">
|
<CascadingValue Value="this">
|
||||||
@ChildContent
|
@ChildContent
|
||||||
@@ -13,7 +14,11 @@
|
|||||||
|
|
||||||
public void Handle(Exception ex)
|
public void Handle(Exception ex)
|
||||||
{
|
{
|
||||||
if (ex is ApiException<ProblemDetails> { StatusCode: (int)HttpStatusCode.Unauthorized or (int)HttpStatusCode.Forbidden })
|
if (ex is ApiException<ProblemDetails>
|
||||||
|
{
|
||||||
|
StatusCode: (int)HttpStatusCode.Unauthorized or (int)HttpStatusCode.Forbidden
|
||||||
|
}
|
||||||
|
or NotLoggedInException)
|
||||||
{
|
{
|
||||||
Nav.NavigateTo("/");
|
Nav.NavigateTo("/");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@page "/applications"
|
@page "/applications"
|
||||||
|
@using BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||||
@using VisaApiClient
|
@using VisaApiClient
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
{
|
{
|
||||||
Constants.ApplicantRole => (await Client.GetForApplicantAsync()).OrderByDescending(a => a.RequestDate).ToList(),
|
Constants.ApplicantRole => (await Client.GetForApplicantAsync()).OrderByDescending(a => a.RequestDate).ToList(),
|
||||||
Constants.ApprovingAuthorityRole => (await Client.GetPendingAsync()).OrderByDescending(a => a.RequestDate).ToList(),
|
Constants.ApprovingAuthorityRole => (await Client.GetPendingAsync()).OrderByDescending(a => a.RequestDate).ToList(),
|
||||||
_ => throw new ArgumentOutOfRangeException()
|
_ => throw new NotLoggedInException()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user