SharpRSS/WebSharpRSS/Pages/Index.razor
2024-06-16 13:43:30 +02:00

38 lines
900 B
Plaintext
Executable File

@page "/"
@page "/dashboard"
@using WebSharpRSS.Models;
@using SharpRss.Models
@using SharpRss.Services
@inject FeedStateContainer _stateContainer;
@inject SyndicationService _service;
<MudGrid Spacing="2" Class="mx-2" Justify="Justify.FlexStart">
@if (_loading)
{
<MudProgressCircular Indeterminate="true" Color="Color.Primary"/>
}
else
{
@foreach (CategoryModel category in _categories)
{
<MudItem>
<DashboardCategoryItemView Category="category"/>
</MudItem>
}
}
</MudGrid>
@code {
bool _loading = true;
HashSet<CategoryModel> _categories = new HashSet<CategoryModel>();
protected override async void OnInitialized()
{
await _service.GetCategoriesAsync().ContinueWith(task =>
{
_categories = task.Result;
_loading = false;
});
}
}