You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Server-Panel/Pages/UserListPanel.razor.cs

34 lines
912 B

using System.Net.Http.Json;
using AdminPanel.Models;
namespace AdminPanel.Pages
{
public partial class UserListPanel
{
public List<User>? Users { get; private set; }
public UserListPanel()
{
HttpClient client = new()
{
BaseAddress = new Uri("http://localhost:8080")
};
RetrieveUsers(client);
}
public void OnAccessToUserSpaceClicked(User user)
{
}
private async void RetrieveUsers(HttpClient client)
{
using HttpResponseMessage response = await client.GetAsync("/api/admin/list-users?start=0&n=100");
response.EnsureSuccessStatusCode();
Users = (await response.Content.ReadFromJsonAsync<List<User>>())!;
StateHasChanged();
Console.WriteLine(Users);
}
}
}