@page "/shorts"
@inject HttpClient httpClient
@inject IConfiguration config
Shorts List
@if (shorts == null)
{
Loading...
}
else if (!shorts.Any())
{
No shorts available.
}
else
{
| Id |
Title |
Description |
Hashtags |
Mp4 URL |
Image URL |
Uploaded |
@foreach (var shortItem in shorts)
{
| @shortItem.Id |
@shortItem.Title |
@shortItem.Description |
@shortItem.Hashtags |
View Video |
View Image |
@(shortItem.IsUploaded ? "Yes" : "No") |
}
}
@code {
private List? shorts;
protected override async Task OnInitializedAsync()
{
try
{
string url = $"{config["ApiUrl"]}/shorts";
shorts = await httpClient.GetFromJsonAsync>(url);
}
catch (Exception ex)
{
Console.Error.WriteLine($"Error fetching shorts: {ex.Message}");
}
}
}