The message is only updated on the second time we click the button that calls DownloadData
@page "/counter"
@using Flurl
@using Flurl.Http
@inject HttpClient Http
<h1>Download Data</h1>
<button @onclick(DownloadData)>Download Data</button>
<p><b>@message</b></p>
@functions {
string message = "";
async void DownloadData()
{
try
{
var url = "https://nnnn.azurewebsites.net/api/PegaOcorrencias/?code=kjsdfklhsdf";
var result = await Http.GetJsonAsync<List<Newtonsoft.Json.Linq.JObject>>(url);
message = "Items count " + result.Count;
}
catch (Exception ex)
{
message = ex.ToString();
}
}
}