using Microsoft.AspNetCore.Components; using Prefab.Web.Client.Models; using Prefab.Web.Client.Services; namespace Prefab.Web.Client.Pages; public class CategoriesComponent : ResultComponentBase { [Inject] protected ICategoriesPageService PageService { get; set; } = null!; protected CategoriesPageModel Page { get; set; } = new(); protected override async Task OnInitializedAsync() { var result = await Execute(PageService.GetPage, CancellationToken.None); if (result.IsSuccess && result.Value is { } value) { Page = value; } else { Page = new CategoriesPageModel(); } } } public class CategoriesPageModel { public IEnumerable Categories { get; set; } = []; }