wabbajack/Wabbajack.App.Blazor/Pages/Gallery.razor
2022-01-12 03:26:47 +11:00

37 lines
813 B
Plaintext

@page "/gallery"
@layout Shared.MainLayout
@using Wabbajack.Networking.WabbajackClientApi;
@using Wabbajack.DTOs
@inject Client _client
<div id="content">
@foreach (ModlistMetadata item in _listItems)
{
<ModlistItem Metadata=@item></ModlistItem>
}
</div>
@code {
List<ModlistMetadata> _listItems = new();
protected override async Task<Task> OnAfterRenderAsync(bool firstRender)
{
if (!firstRender) return base.OnAfterRenderAsync(firstRender);
try
{
ModlistMetadata[] modLists = await _client.LoadLists();
_listItems = modLists.ToList();
StateHasChanged();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
return base.OnAfterRenderAsync(firstRender);
}
}