Update and delete games (#48)
All checks were successful
Game Ideas deploy / build-test-deploy (push) Successful in 1m27s

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #48
This commit was merged in pull request #48.
This commit is contained in:
2025-05-13 14:13:31 +02:00
parent ae39e15d32
commit edd3ac78de
32 changed files with 604 additions and 150 deletions

View File

@@ -0,0 +1,58 @@
using GameIdeas.BlazorApp.Pages.Games.Gateways;
using GameIdeas.BlazorApp.Shared.Models;
using GameIdeas.Shared.Dto;
using Microsoft.AspNetCore.Components;
namespace GameIdeas.BlazorApp.Shared.Components;
public class GameBaseComponent : ComponentBase
{
[Inject] protected IGameGateway GameGateway { get; set; } = default!;
protected Popup.Popup? ManualAddPopup;
protected CategoriesDto? Categories;
protected bool IsLoading = false;
protected override async Task OnInitializedAsync()
{
await HandleFetchCategories();
await base.OnInitializedAsync();
}
protected async Task HandleFetchCategories()
{
try
{
IsLoading = true;
Categories = await GameGateway.FetchCategories();
}
catch (Exception)
{
throw;
}
finally
{
IsLoading = false;
}
}
protected void HandleAddClicked(AddType addType)
{
switch (addType)
{
case AddType.Manual:
ManualAddPopup?.Open();
break;
case AddType.Auto:
break;
default:
break;
}
}
protected void HandleBackdropManualAddClicked()
{
ManualAddPopup?.Close();
}
}