@page "/test/1"
@inherits MainBase
@inject HttpClient HttpClient

<LayoutPageTitle>Test webapi call 1</LayoutPageTitle>

<PageHeader
    BreadcrumbItems="@BreadcrumbItems"
    Title="Test webapi call 1"
    Description="Test webapi call 1">
</PageHeader>

@if (IsLoading)
{
    <LoadingIndicator />
}
else
{
    <p>Test 1 OK.</p>
}

@code {
    private bool IsLoading { get; set; } = true;

    /// <inheritdoc />
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await base.OnAfterRenderAsync(firstRender);

        if (firstRender)
        {
            await MakeWebApiCall();
        }
    }

    private async Task MakeWebApiCall()
    {
        await HttpClient.GetAsync("v1/Test");

        IsLoading = false;
        StateHasChanged();
    }
}
