Fix and harden prospect creation against Blazor runtime crashes
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 3m3s
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 3m3s
- Handle empty numeric input safely with nullable integer binding. - Add semaphore locks to prevent double-click invocation errors on mobile. - Implement global exception handling and user notifications for prospect operations.
This commit is contained in:
@@ -96,15 +96,33 @@ namespace FoodsharingSiegen.Server.Dialogs
|
|||||||
if (IsUpdateMode)
|
if (IsUpdateMode)
|
||||||
{
|
{
|
||||||
var updateR = await ProspectService.UpdateAsync(Prospect);
|
var updateR = await ProspectService.UpdateAsync(Prospect);
|
||||||
if (updateR.Success && OnSuccess != null) await OnSuccess.Invoke();
|
if (updateR.Success)
|
||||||
|
{
|
||||||
|
if (OnSuccess != null) await OnSuccess.Invoke();
|
||||||
|
await ModalService.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await Notification.Error(updateR.Exception?.Message ?? "Unbekannter Fehler beim Speichern.", "Fehler");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var addR = await ProspectService.AddProspectAsync(Prospect);
|
var addR = await ProspectService.AddProspectAsync(Prospect);
|
||||||
if (addR.Success && OnSuccess != null) await OnSuccess.Invoke();
|
if (addR.Success)
|
||||||
|
{
|
||||||
|
if (OnSuccess != null) await OnSuccess.Invoke();
|
||||||
|
await ModalService.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await Notification.Error(addR.Exception?.Message ?? "Unbekannter Fehler beim Hinzufügen.", "Fehler");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
await ModalService.Hide();
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await Notification.Error(ex.Message, "Systemfehler");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,15 +100,22 @@ namespace FoodsharingSiegen.Server.Pages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task LoadProspects()
|
private async Task LoadProspects()
|
||||||
{
|
{
|
||||||
var parameter = new GetProspectsParameter
|
try
|
||||||
{
|
{
|
||||||
CannotHaveInteractions = [InteractionType.Complete, InteractionType.Verify, InteractionType.ReleasedForVerification]
|
var parameter = new GetProspectsParameter
|
||||||
};
|
{
|
||||||
|
CannotHaveInteractions = [InteractionType.Complete, InteractionType.Verify, InteractionType.ReleasedForVerification]
|
||||||
|
};
|
||||||
|
|
||||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||||
|
|
||||||
await InvokeAsync(StateHasChanged);
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await Notification.Error(ex.Message, "Fehler beim Laden");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user