@page "/"
@inject LinksClient Links
Liens publiés
@if (_error)
{
Oups!
}
else if (_links == null)
{
Chargement en cours
}
else if (_links.Length == 0)
{
Aucun lien pour le moment :'(
}
else
{
@foreach (var link in _links)
{
-
}
}
@code {
private LinkDto[] _links;
private bool _error = false;
protected override async Task OnInitializedAsync()
{
try {
_links = (await Links.GetLinksAsync()).ToArray();
} catch {
_error = true;
}
}
}