Add frontend creation game (#13)

Reviewed-on: #13
This commit was merged in pull request #13.
This commit is contained in:
2025-04-13 17:21:15 +02:00
parent 3ea96186e7
commit 225e8ba140
60 changed files with 913 additions and 231 deletions

View File

@@ -0,0 +1,24 @@
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.Games.Gateways;
public class GameGateway(IHttpClientService httpClientService) : IGameGateway
{
public async Task<CategoriesDto> FetchCategories()
{
try
{
var result = await httpClientService.FetchDataAsync<CategoriesDto>(Endpoints.Category.AllCategories);
return result ?? throw new InvalidOperationException(ResourcesKey.ErrorFetchCategories);
}
catch (Exception)
{
throw new CategoryNotFoundException(ResourcesKey.ErrorFetchCategories);
}
}
}