Add gateway and filter
Some checks failed
Game Ideas build for PR / build_blazor_app (pull_request) Failing after 29s
Some checks failed
Game Ideas build for PR / build_blazor_app (pull_request) Failing after 29s
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using GameIdeas.BlazorApp.Services;
|
||||
using GameIdeas.BlazorApp.Shared.Constants;
|
||||
using GameIdeas.BlazorApp.Shared.Exceptions;
|
||||
using GameIdeas.Resources;
|
||||
using GameIdeas.Shared.Dto;
|
||||
|
||||
namespace GameIdeas.BlazorApp.Pages.Users.Gateways;
|
||||
|
||||
public class UserGateway(IHttpClientService httpClient) : IUserGateway
|
||||
{
|
||||
public async Task<UserListDto> GetUsers(UserFilterParams filterParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserFilterDto filter = new()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
var url = Endpoints.User.Fetch(filter);
|
||||
return await httpClient.FetchDataAsync<UserListDto>(url)
|
||||
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchUsers);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new UserNotFoundException(ResourcesKey.ErrorFetchUsers);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user