SharpRSS/WebSharpRSS/Pages/Index.razor

38 lines
900 B
Plaintext

@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;
});
}
}