Skip to content

Commit

Permalink
Add countries field to Home.razor; update project refs
Browse files Browse the repository at this point in the history
In Home.razor, added a private field `countries` to store a
collection of countries and updated `OnInitializedAsync` to
initialize this field by fetching data from `CountryService`.
In CountryData.Sample.ConsoleProject.csproj, removed an
unnecessary project reference to simplify dependencies.
  • Loading branch information
Clifftech123 committed Sep 23, 2024
1 parent 4b74c36 commit 0784053
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions sample/CountryData.Sample.Blazor/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ else
}

@code {
/// <summary>
/// A collection of countries to be displayed on the page.
/// </summary>
private IEnumerable<Country>? countries;

/// <summary>
/// Initializes the component and loads the country data.
/// </summary>
protected override async Task OnInitializedAsync()
{
countries = await CountryService.GetCountries();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

<ItemGroup>
<ProjectReference Include="..\..\src\CountryData.Standard\CountryData.Standard.csproj" />
<ProjectReference Include="..\CountryData.Sample.MAUI\CountryData.Sample.MAUI\CountryData.Sample.MAUI.csproj" />
</ItemGroup>

</Project>
Expand Down

0 comments on commit 0784053

Please sign in to comment.