@page "/gallery" @namespace Wabbajack.App.Blazor.Pages @using Wabbajack.Networking.WabbajackClientApi; @using Wabbajack.DTOs @using System.Diagnostics @using Microsoft.Extensions.Logging @using Wabbajack.App.Blazor.Models @inject Client _client
@foreach (ModlistMetadata item in _listItems) { }
@code { [Inject] private ILogger _logger { get; set; } // [Inject] // private LoggerProvider _loggerProvider { get; set; } [Inject] private Services.OSIntegrated.Configuration _configuration { get; set; } private List _listItems { get; set; } = new() { }; protected override async Task OnInitializedAsync() { try { _logger.LogInformation("Getting modlists..."); ModlistMetadata[] modLists = await _client.LoadLists(); _listItems.AddRange(modLists.ToList()); StateHasChanged(); } catch (Exception ex) { //TODO: [Critical] Figure out why an exception is thrown on first navigation. Debug.Print(ex.Message); _logger.LogError(ex, "Error while loading lists"); } await base.OnInitializedAsync(); } }