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:
@@ -272,7 +272,7 @@
|
||||
{
|
||||
<button type="button"
|
||||
class="sender-create-wizard__suggestion-item"
|
||||
@onclick="() => ApplyRecentSuggestion(suggestion)"
|
||||
@onclick="() => ApplyRecentSuggestionAndAddAsync(suggestion)"
|
||||
disabled="@IsActionLocked">
|
||||
<span class="sender-create-wizard__suggestion-name">@suggestion.FullName</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)
|
||||
return;
|
||||
|
||||
_receiverName = suggestion.FullName;
|
||||
_receiverEmail = suggestion.EmailAddress;
|
||||
_validationMessage = null;
|
||||
await AddReceiver();
|
||||
}
|
||||
|
||||
private bool ValidateCurrentStep()
|
||||
|
||||
Reference in New Issue
Block a user