Create game from form #15

Merged
Egamorf merged 8 commits from feature/create-game into main 2025-04-15 23:33:02 +02:00
3 changed files with 8 additions and 2 deletions
Showing only changes of commit 01ada94adb - Show all commits

View File

@@ -16,6 +16,7 @@ public partial class GameCreationForm
[Inject] private IGameGateway GameGateway { get; set; } = default!;
[CascadingParameter] private Popup? Popup { get; set; }
[Parameter] public CategoriesDto? Categories { get; set; }
[Parameter] public EventCallback OnSubmit { get; set; }
private GameDto GameDto = new();
private EditContext? EditContext;
@@ -57,6 +58,7 @@ public partial class GameCreationForm
if (gameId != 0)
{
Popup?.Close();
await OnSubmit.InvokeAsync();
}
}
catch (Exception)

View File

@@ -25,5 +25,5 @@
</div>
<Popup @ref=ManualAddPopup BackdropFilterClicked="HandleBackdropManualAddClicked" Closable=false>
<GameCreationForm Categories="Categories" />
<GameCreationForm Categories="Categories" OnSubmit="HandleFetchCategories" />
</Popup>

View File

@@ -17,7 +17,7 @@ public partial class GameBase ()
protected override async Task OnInitializedAsync()
{
Categories = await GameGateway.FetchCategories();
await HandleFetchCategories();
await base.OnInitializedAsync();
}
private void HandleAddClicked(AddType addType)
@@ -37,4 +37,8 @@ public partial class GameBase ()
{
ManualAddPopup?.Close();
}
private async Task HandleFetchCategories()
{
Categories = await GameGateway.FetchCategories();
}
}