[frontend/components] Display error notice when poll voting fails
This commit is contained in:
parent
8da7bf7cf7
commit
ace2c44279
1 changed files with 12 additions and 2 deletions
|
@ -1,7 +1,10 @@
|
||||||
|
@using Iceshrimp.Frontend.Core.Miscellaneous
|
||||||
|
@using Iceshrimp.Frontend.Core.Services
|
||||||
@using Iceshrimp.Frontend.Core.Services.NoteStore
|
@using Iceshrimp.Frontend.Core.Services.NoteStore
|
||||||
@using Iceshrimp.Frontend.Localization
|
@using Iceshrimp.Frontend.Localization
|
||||||
@using Iceshrimp.Shared.Schemas.Web
|
@using Iceshrimp.Shared.Schemas.Web
|
||||||
@using Microsoft.Extensions.Localization
|
@using Microsoft.Extensions.Localization
|
||||||
|
@inject GlobalComponentSvc Global;
|
||||||
@inject NoteActions NoteActions;
|
@inject NoteActions NoteActions;
|
||||||
@inject IStringLocalizer<Localization> Loc;
|
@inject IStringLocalizer<Localization> Loc;
|
||||||
|
|
||||||
|
@ -84,6 +87,13 @@
|
||||||
{
|
{
|
||||||
if (!CanVote()) return;
|
if (!CanVote()) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
await NoteActions.AddPollVoteAsync(Poll, Choices);
|
await NoteActions.AddPollVoteAsync(Poll, Choices);
|
||||||
}
|
}
|
||||||
|
catch (ApiException e)
|
||||||
|
{
|
||||||
|
await Global.NoticeDialog?.Display(e.Response.Message ?? Loc["An unknown error occurred while voting"], NoticeDialog.NoticeType.Error)!;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue