1
0
mirror of synced 2024-12-11 05:55:59 +01:00
GC-local-server-rewrite/MudAdmin/Pages/Users.razor

44 lines
1.3 KiB
Plaintext

@page "/users"
@using models = SharedProject.models
@inject NavigationManager NavigationManager
@inject HttpClient Client
<PageTitle>Users</PageTitle>
<MudGrid>
@foreach (var user in users)
{
<MudItem>
<MudCard>
<MudCardHeader>
<CardHeaderContent>
<MudText Typo="Typo.h6">@user.PlayerName</MudText>
</CardHeaderContent>
</MudCardHeader>
<MudCardContent>
<MudText Typo="Typo.h6">Card ID</MudText>
<MudText>@user.CardId</MudText>
</MudCardContent>
<MudCardActions>
<MudButton Variant="Variant.Text" Color="Color.Primary" OnClick="() => OnClick(user)">Test</MudButton>
</MudCardActions>
</MudCard>
</MudItem>
}
</MudGrid>
@code {
private List<models.User> users = new();
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
users = await Client.GetFromJsonAsync<List<models.User>>("api/Users") ?? new List<models.User>();
}
private void OnClick(models.User user)
{
NavigationManager.NavigateTo($"user/{user.CardId}");
}
}