1
0
mirror of synced 2024-12-12 14:51:08 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Users.razor.cs

31 lines
1.0 KiB
C#
Raw Normal View History

2024-03-16 10:46:06 +01:00
namespace TaikoWebUI.Pages;
2022-09-11 18:33:58 +02:00
public partial class Users
2022-09-11 18:33:58 +02:00
{
// Tuple of User and UserSetting
private List<(User, UserSetting)>? usersWithSettings;
2022-09-11 18:33:58 +02:00
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
if (AuthService.LoginRequired && !AuthService.IsLoggedIn)
{
await AuthService.LoginWithAuthToken();
}
2024-05-17 00:32:46 +02:00
if (AuthService.IsAdmin || !AuthService.LoginRequired)
{
var users = await Client.GetFromJsonAsync<List<User>>("api/Users");
var userSettings = await Client.GetFromJsonAsync<List<UserSetting>>("api/UserSettings");
if (users != null && userSettings != null)
{
// Combine User and UserSetting with the same Baid
usersWithSettings = users.Join(userSettings,
user => user.Baid,
setting => setting.Baid,
(user, setting) => (user, setting))
.ToList();
}
2024-05-17 00:32:46 +02:00
}
2022-09-11 18:33:58 +02:00
}
}