Push alert when there is an error deleting a game

net8.0
Pat Hartl 2023-11-27 20:28:51 -06:00
parent ab67092c2f
commit d0d6701380
1 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,7 @@
@attribute [Authorize] @attribute [Authorize]
@inject GameService GameService @inject GameService GameService
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IMessageService MessageService
<PageHeader Title="Games"> <PageHeader Title="Games">
<PageHeaderExtra> <PageHeaderExtra>
@ -174,7 +175,14 @@
Loading = true; Loading = true;
await GameService.Delete(game); try
{
await GameService.Delete(game);
}
catch (Exception ex)
{
MessageService.Error("Could not delete the game!");
}
Games = await GameService.Get(x => true).OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToListAsync(); Games = await GameService.Get(x => true).OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToListAsync();