Fix EditProspectDialog and Prospects: prevent multiple modal openings during save and create operations
This commit is contained in:
@@ -82,10 +82,16 @@ namespace FoodsharingSiegen.Server.Dialogs
|
||||
|
||||
#region Private Method SaveClick
|
||||
|
||||
private bool _isSaving;
|
||||
|
||||
/// <summary>
|
||||
/// Saves the click (a. beging, 31.05.2022)
|
||||
/// </summary>
|
||||
private async Task SaveClick()
|
||||
{
|
||||
if (_isSaving) return;
|
||||
_isSaving = true;
|
||||
try
|
||||
{
|
||||
if (IsUpdateMode)
|
||||
{
|
||||
@@ -100,6 +106,11 @@ namespace FoodsharingSiegen.Server.Dialogs
|
||||
|
||||
await ModalService.Hide();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -56,14 +56,25 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#region Private Method CreateProspectAsync
|
||||
|
||||
private bool _isOpeningModal;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously creates a new prospect by displaying the AddProspectModal dialog and refreshing the prospect list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
private async Task CreateProspectAsync()
|
||||
{
|
||||
if (_isOpeningModal) return;
|
||||
_isOpeningModal = true;
|
||||
try
|
||||
{
|
||||
await EditProspectDialog.ShowAsync(ModalService, LoadProspects);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isOpeningModal = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user