Refactor recent suggestion handling to use async method

Replaced the synchronous `ApplyRecentSuggestion` method with the new asynchronous `ApplyRecentSuggestionAndAddAsync` method. Updated the `@onclick` event handler in the suggestion list to use the async method. Removed `_validationMessage = null;` from the logic, and added an `await AddReceiver()` call to handle receiver addition asynchronously. These changes improve responsiveness and support additional async operations.
This commit is contained in:
2026-11-09 13:34:17 +01:00
parent ceb2860883
commit 4a10db0865

View File

@@ -272,7 +272,7 @@
{ {
<button type="button" <button type="button"
class="sender-create-wizard__suggestion-item" class="sender-create-wizard__suggestion-item"
@onclick="() => ApplyRecentSuggestion(suggestion)" @onclick="() => ApplyRecentSuggestionAndAddAsync(suggestion)"
disabled="@IsActionLocked"> disabled="@IsActionLocked">
<span class="sender-create-wizard__suggestion-name">@suggestion.FullName</span> <span class="sender-create-wizard__suggestion-name">@suggestion.FullName</span>
<span class="sender-create-wizard__suggestion-email">@suggestion.EmailAddress</span> <span class="sender-create-wizard__suggestion-email">@suggestion.EmailAddress</span>
@@ -954,14 +954,14 @@
} }
} }
private void ApplyRecentSuggestion(RecentReceiverSuggestionDto suggestion) private async Task ApplyRecentSuggestionAndAddAsync(RecentReceiverSuggestionDto suggestion)
{ {
if (IsActionLocked) if (IsActionLocked)
return; return;
_receiverName = suggestion.FullName; _receiverName = suggestion.FullName;
_receiverEmail = suggestion.EmailAddress; _receiverEmail = suggestion.EmailAddress;
_validationMessage = null; await AddReceiver();
} }
private bool ValidateCurrentStep() private bool ValidateCurrentStep()