Add validation and gateway creation
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 1m14s
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 1m14s
This commit is contained in:
@@ -8,6 +8,20 @@ namespace GameIdeas.BlazorApp.Pages.Games.Gateways;
|
||||
|
||||
public class GameGateway(IHttpClientService httpClientService) : IGameGateway
|
||||
{
|
||||
public async Task<GameDto> CreateGame(GameDto game)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await httpClientService.PostAsync<GameDto>(Endpoints.Game.Create, game);
|
||||
|
||||
return result ?? throw new InvalidOperationException(ResourcesKey.ErrorCreateGame);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new GameCreationException(ResourcesKey.ErrorCreateGame);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<CategoriesDto> FetchCategories()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user