Add validation and gateway creation
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 1m14s

This commit is contained in:
Maxime Adler
2025-04-14 16:23:45 +02:00
parent b16d997417
commit 3447fa6eb1
14 changed files with 101 additions and 49 deletions

View File

@@ -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