SHA256
GuestLog - User message improvements
- Added UserMessageService to have common methods for showing messages and errors to the user. - Added Result record so services can return status on operation error (so it can be shown in the UI messages). - Updated services to use the new Result record. - Updated pages to use the new IUserMessageService.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
@using Somnia.GuestLog.Models.DTOs;
|
||||
@using Somnia.GuestLog.Services
|
||||
@using Somnia.GuestLog.Services.AddressQuery;
|
||||
|
||||
@inject ILogger<AddressQueryDialog> logger;
|
||||
@inject IAddressQueryFactory addressQueryFactory;
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IUserMessageService userMessage
|
||||
|
||||
<MudDialog @ref="@DialogRef">
|
||||
<TitleContent>
|
||||
@@ -112,7 +113,7 @@
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "SearchAddress returned an error!");
|
||||
Snackbar.Add($"Error searching address: {ex.Message}", Severity.Error);
|
||||
userMessage.ShowMessage($"Error searching address: {ex.Message}", MessageKind.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@
|
||||
{
|
||||
if (SelectedAddressResult is null)
|
||||
{
|
||||
Snackbar.Add("Select an address", Severity.Warning);
|
||||
userMessage.ShowMessage("Select an address", MessageKind.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user