Skip to content

Commit

Permalink
Implement logic to handle AccessTokenNotAvailableException
Browse files Browse the repository at this point in the history
  • Loading branch information
liguori committed Nov 18, 2024
1 parent f66cf7f commit 367df6a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Savings.SPA/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@inherits LayoutComponentBase
@inject IJSRuntime JS
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication;

<RadzenComponents />
<div class="page">
Expand All @@ -7,7 +9,20 @@
</div>
<main>
<article class="content px-4">
@Body
<ErrorBoundary>
<ChildContent>
@Body
</ChildContent>
<ErrorContent Context="ex">
@{
//Capture when the access token can't be retrieved (i.e. refresh token is expired after 1d) and perform an interactive redirect
if (ex is AccessTokenNotAvailableException)
{
((AccessTokenNotAvailableException)ex).Redirect();
}
}
</ErrorContent>
</ErrorBoundary>
</article>
</main>
</div>

0 comments on commit 367df6a

Please sign in to comment.