Correction de l'acces a la page chrono

This commit is contained in:
2026-04-13 23:26:00 +02:00
parent aac7977620
commit 7efdbc57a8
3 changed files with 17 additions and 4 deletions

View File

@@ -50,7 +50,7 @@
</p>
</div>
<form class="setup-form" @onsubmit="HandleSubmit">
<form class="setup-form" @onsubmit="HandleSubmit" @onsubmit:preventDefault="true" novalidate>
<label class="option-card competition-option span-2 @(Form.CompetitionMode ? "is-selected" : string.Empty)">
<input @bind="Form.CompetitionMode" id="competitionMode" name="competitionMode" type="checkbox" />
<strong>Mode competition</strong>
@@ -174,7 +174,7 @@
</div>
<div class="setup-actions span-2">
<button class="button primary" type="submit">Ouvrir la page chrono</button>
<button class="button primary" type="button" @onclick="HandleSubmit">Ouvrir la page chrono</button>
<button class="button secondary" id="loadDemoButton" type="button" @onclick="LoadDemo">Charger une demo</button>
<a class="button ghost" href="reglement.html">Consulter le reglement</a>
</div>
@@ -300,9 +300,20 @@
private async Task HandleSubmit()
{
await Store.EnsureLoadedAsync();
var match = MatchEngine.CreateMatch(Form.ToMatchConfig());
Store.SetCurrent(match);
await Store.SaveAsync();
try
{
await Store.SaveAsync();
}
catch
{
// La navigation vers la phase chrono doit rester possible meme si la persistence
// du navigateur echoue ponctuellement.
}
Navigation.NavigateTo("/chrono.html");
}