@page "/person/{Address}"
@Address
@if (bio == null)
{
Getting Bio...
}
else {
@bio
}
@code {
[Parameter]
public string Address { get; set; }
private Status[] statuses;
private MarkupString? bio;
protected override async Task OnInitializedAsync() {
RestService api = new RestService();
await GetBioAsync(api);
}
private async Task GetBioAsync(RestService api) {
bio = await api.StatuslogBio(Address);
}
public async ValueTask> GetStatuses(ItemsProviderRequest request) {
// TODO: request.cancellationToken
RestService api = new RestService();
statuses = (await api.Statuslog(Address)).ToArray() ?? new Status[0];
var numStatuses = Math.Min(request.Count, statuses.Length - request.StartIndex);
return new ItemsProviderResult(statuses.Skip(request.StartIndex).Take(numStatuses), statuses.Length);
}
private List pics;
private async ValueTask> GetPics(ItemsProviderRequest request) {
// TODO: request.cancellationToken
RestService api = new RestService();
if (pics == null || pics.Count == 0) pics = await api.SomePics(Address);
var numPics = Math.Min(request.Count, pics.Count - request.StartIndex);
return new ItemsProviderResult(pics.Skip(request.StartIndex).Take(numPics), pics.Count);
}
}