Skip to content

Commit

Permalink
Prevent infinite loop when unauthenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjonsson01 committed May 10, 2022
1 parent 5c8d16c commit e7be995
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Client/Pages/Contracts/RecentlyViewed.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
@using Application.Contracts
@using System.Collections.ObjectModel
@inject HttpClient _http
@inject ISessionService _session
@inherits AuthenticatedView

<FetchData TData="Contract[]"
Url="/api/v1/contracts/recent"
Context="recents"
ShouldShowErrors="@false">
ShouldShowErrors="@_session.IsAuthenticated">

<!-- No loading indicator. -->
<LoadingIndicator></LoadingIndicator>
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Shared/FetchData.razor
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ else
/// <inheritdoc />
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (Data is null)
if (Data is null && _errorMessage is null)
await Fetch(Url);
}

Expand Down

0 comments on commit e7be995

Please sign in to comment.